0

I am migrating from Spring Boot 2 to Spring boot 3, and switched from spring cloud sleuth to io.micrometer:micrometer-tracing-bridge-brave in the migration process. I noticed that Spring Boot 2 services use b3 headers to propagate span & trace IDs, while the new Spring Boot 3 projects use a w3c traceparent header.

To still be able to trace messages through multiple Spring Boot 2 and Spring Boot 3 services in our own domain, I configured every Spring Boot 3 service in our domain to keep using the "old" B3 format using this stackoverflow post:

@Bean
public Tracing braveTracing() {
    return Tracing.newBuilder()
            .propagationFactory(B3Propagation.newFactoryBuilder().injectFormat(B3Propagation.Format.SINGLE).build())
            .build();
}

Which works, however I'd rather have the Spring Boot 3 applications recognize both formats and (if possible) propagate both formats as well. The reason is that applications outside our domain expect the W3C header instead of the B3 header. Would anyone know if this is possible?

Michiel
  • 2,914
  • 1
  • 18
  • 27

1 Answers1

1

Documentation says it is not possible :

Since the default propagation format is w3c and in Spring Boot 3.0 we don't support multiple propagation types, you should set in your Sleuth & Boot 2.x application spring.sleuth.propagation.type=w3c,b3 so that you publish the headers in 2 formats. One for the current Boot 2.x applications (b3) and one for the new Boot 3.x applications (w3c).

Spring-Cloud-Sleuth-3.1-Migration-Guide

In our case, we added a custom interceptor over our OkHttpClient to propagate both formats.

dpittori
  • 46
  • 2