1

I have several Spring Boot applications, one of which is using Spring Boot 3 and the others are using Spring Boot 2. I need to implement request tracing between them and between them and Kafka. However, I haven't found anything on how to integrate tracing via Spring Cloud Sleuth on one application and Micrometer-tracing on another application. Is there any way to retrieve the trace ID generated by Sleuth in an application that uses Micrometer Tracing and backwards?

I tried to connect sleuth and micrometer-tracing in apps and send http requests to spring boot 2 app which sent a message to kafka which read the spring boot 3 app but traceId only showed up in spring boot 2 app

Brian Clozel
  • 56,583
  • 15
  • 167
  • 176
Eygonb
  • 53
  • 4

2 Answers2

3

Both Sleuth and Micrometer Tracing support B3 and W3C propagation formats. Sleuth uses B3 by default, Boot 3 configures Micrometer Tracing to use W3C. Changing this behavior is either:

# Boot 2.x/Sleuth
spring.sleuth.propagation.type

or

# Boot 3.x/Micrometer Tracing
management.tracing.propagation.type
Jonatan Ivanov
  • 4,895
  • 2
  • 15
  • 30
  • Setting these options didn't change anything, including not changing traceId length in applications, spring boot 3 applications print traceId 32 characters long and spring boot 2 16 characters long, but thanks for the information for researching – Eygonb May 03 '23 at 02:46
1

Hey we describe in the wiki page on how to migrate from Boot 2.7 to Boot 3.0 (https://github.com/micrometer-metrics/tracing/wiki/Spring-Cloud-Sleuth-3.1-Migration-Guide). You should provide 2 propagation types on the Boot 2.7 side (W3C, B3) and automatically Boot 3.0 will pick up the W3C one.

Since Boot 3.0 disallows joined spans and sets trace id to be of 128 bit, set the same configuration on the Sleuth side.

spring.sleuth.traceId128=true
spring.sleuth.supportsJoin=false
Marcin Grzejszczak
  • 10,624
  • 1
  • 16
  • 32