Search code examples
spring-bootspring-cloudspring-cloud-sleuthdistributed-tracing

Spring Boot Sleuth - TraceI vs TraceIdString


I am learning about sleuth tracing. And while running the application, I could see logs with trace Id (ec88298d62773aa6) along with spandId and application name. What I want to know is

  1. ID available in logs is traceIdString and not traceId ?
  2. What is the difference between the two ?
  3. And during logs analysis, should we consider traceId or traceIdString?

Sample log

2021-10-07 16:35:04.421  INFO [demo,ec88298d62773aa6,ec88298d62773aa6] 1324 --- [nio-8080-exec-1] com.example.demo.demo.DemoApplication    : inside controller method

Thanks for your response.


Solution

  • traceIdString is the hex representation of the traceId as can be seen here: https://github.com/openzipkin/brave/blob/master/brave/src/main/java/brave/propagation/TraceContext.java#L218

    During problem analysis you will usually see the hex representation in logs or the user interfaces of distributed tracing systems.