Reproducer
Please find the reproducer project here: https://github.com/jackcat13/noB3HeadersInWebClientSB3 And you can find the equivalent working example with SB2 in the branch here: https://github.com/jackcat13/noB3HeadersInWebClientSB3/tree/workingWithSB2
Description
While working on migrating a project from SB2 to SB3, I met a regression about propagation of B3 headers in WebClient instances.
Note: I could properly do propagation of B3 headers in any other case, I've only encountered the regression for WebClient instances.
You can reproduce the problem at your end using the shared reproducer above. You simply need to execute the Unit test in the project. The flow of the test is the following:
- A
WebTestClientinstance calls a Rest Api of a testSpringBootApplicationa. B3 headers are sent with the call - In the Rest Api, a call to a remote API is performed using a
WebClientinstance a. The remote API is available via a Wiremock instance b. At this step, in SB3, no propagation of B3 headers is performed whereas it is performed in SB2 branch
I understand that the difference of behavior must be related to the replacement of Spring-cloud-sleuth to Micrometer library. Please let me know if the regression observed should be logged in any other repository than Spring boot itself. I was not able to figure out the best repository to report the bug because it's a problem encountered somewhere between Micrometer and the WebClient.
Thanks in advance for your help.
Comment From: bclozel
@jackcat13 have you seen the migration guide? The default propagation header format is now w3c, see https://github.com/micrometer-metrics/tracing/wiki/Spring-Cloud-Sleuth-3.1-Migration-Guide#high-level-overview
Does this help?
Comment From: jackcat13
@bclozel, Actually, B3 propagation is activated in the application.yml for management.tracing.propagation.type property.
Do I miss something?
Comment From: bclozel
I'm not sure why there's a change of behavior here in the headers format, but the B3 headers aren't "X-B3-*" anymore, but rather a single "b3" header.
Changing your test setup with the following makes the test pass.
"request": {
"method": "GET",
"url": "/.well-known/jwks-tracing",
"headers": {
"b3": {
"matches": "463ac35c9f6413ad48485a3953bb6124-[0-9a-f]{16}-d"
}
}
},
It looks like you can revert to using a "MULTI" header approach with a custom propagation factory.
I'm closing this issue since this is behaving as expected on the Spring Boot side. Feel free to create a micrometer-tracing issue if you believe this can be improved.
Thanks!