Search code examples
javaspringspring-cloud-sleuth

spring-cloud-sleuth header from legacy application


While creating a microservice I decided to experiment with Spring-cloud sleuth.

My calling application is still on old version of Spring and it is not possible to include Spring-cloud-sleuth into the scope.

While referring to the documentation, it says that I need to pass just these 2 headers. X-B3-TraceId X-B3-SpanId

But is there a Specific format that I should be using to make it in compliance with the future. In my case, it failed when I used a non HEX value .. then debugged andfigured out that this value has to be in hex. Should it be just any random hex or or any specific pattern I need to respect.


Solution

  • Yes, we are Zipkin compatible thus you have to have proper 64 or 128 bit numer - please check the Zipkin documentation for more information http://zipkin.io/pages/instrumenting.html . You can also check the Javadocs - https://github.com/spring-cloud/spring-cloud-sleuth/blob/master/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/Span.java#L55-L62