The Solutions:
Solution 1: Using application.yml
Configure both B3 and W3C formats in Spring Boot 3 applications using the `application.yml` file. Set the `consume` and `produce` properties to include both formats, as shown below:
“`yaml
management:
tracing:
propagation:
consume: [b3, w3c]
produce: [b3, w3c]
“`
This allows Spring Boot 3 services to recognize and propagate both formats, ensuring compatibility with both Spring Boot 2 and 3 applications.
Solution 2: Custom Interceptor Propagation
In Spring Boot 3, multiple propagation formats are not supported. However, you can use a custom interceptor to propagate both B3 and W3C trace formats in between Spring Boot 2 and 3 applications.
To do this, you can implement an interceptor that intercepts the outgoing requests and adds both B3 and W3C trace headers to the request.
Q&A
How to use multiple tracing header types?
Remove the Tracing
bean and set consume
and produce
properties in the application.yml
with b3
and w3c
values.
Is it possible to support multiple propagation types in Spring Boot 3?
No, Spring Boot 3 only supports a single propagation type.