Good morning! I'm running into the similar issue when switching from Spring Cloud Sleuth to Micrometer Tracing. With Sleuth everything just seems to work with Reactor based Spring project. When upgrading our service to Spring Boot 3.1.0 and adding the dependency,
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-tracing-bridge-brave</artifactId>
</dependency>
the traceId
and spanId
are no logging present in the logs. I've also tried using Hooks.enableAutomaticContextPropagation()
, that didn't work either. So it seems that when updating to Spring Boot 3.x, we lose the ability for distributed tracing. I've read this post and many others that seemingly tracing is not supported using Spring Webflux. If there's an update on when this will be available to Webflux projects that would great to now.
Spring Boot version: 3.1.0 Micrometer Tracing version: 1.1.1
Here's a link to same project demonstrating the issue: https://github.com/joseph-freeman/micrometer-tracing-issue
Comment From: OlegDokuka
@joseph-freeman can you please provide an exact reproducer of the problem.
Thanks, Oleh
Comment From: joseph-freeman
@OlegDokuka Not exactly sure what I need to provide if the repo I create is not sufficient. When you run the service provided by the link, are you seeing the traceId and spanId in the logs? That's the issue I'm having. Either there's additional configuration necessary to have the traceId and spanId in the logs that's not documented, or I'm not understanding how tracing should be setup with a Spring Boot Webflux project. Can you provide a working example uses Spring Webflux that's logging the trace and span IDs in the logfile?
Comment From: bclozel
I've submitted a PR to your sample application. I took the liberty to remove everything and only keep the essential.
I think your app missed Hooks.enableAutomaticContextPropagation();
. Please follow/upvote the dedicated Spring Boot issue spring-projects/spring-boot#34201 if you would like it to be a configuration property or even the default.
I don't see any issue left on the Spring Framework side, so I'm closing this.
Thanks!
Comment From: joseph-freeman
@bclozel Thanks for the update. So Micrometer tracing doesn't support logging the trace and span IDs when using Log4j2. That's the only other difference (minus the addition Hooks.enableAutomaticContextPropagation();
, which I did try before be nothing work, it looks like the main issue is Log4j2 integration with tracing. locally I added back the log4j2.properties
and dependency and it did not work. Works with out it. We heavily use Log4j, should I open another issue in regards to tracing not working when using Log4j2?
Comment From: bclozel
I don't think this is a fair assessment. While there is an issue with the log4J setup, the job of context propagation is to ensure that the current observation is available at as a thread local value or in the reactor context. Spring Framework's responsibility is to instrument the infrastructure for observations. Both work here.
Maybe there is an issue with the logging setup that prevents the MDC from working properly? spring-projects/spring-boot#31468 suggests that it requires SLF4J. Have you tried with such a setup?
Comment From: bclozel
Just a thought - maybe join the micrometer.io Slack to discuss that with the community ?