Spring Boot 3 Webflux project missing traceId and spanId in logs
See original GitHub issueWhen upgrading to Spring Boot 3 (and Micrometer) I noticed the traceId and spanId are not added to the logs when it’s a Webflux project.
Webflux: https://github.com/sanderino666/webflux-micrometer-logs
2022-11-26T17:27:44.991+01:00 INFO [,,] 19376 --- [ctor-http-nio-3] com.example.demo.DemoApplication : home() has been called
MVC: https://github.com/sanderino666/mvc-micrometer-logs
2022-11-26T17:24:12.050+01:00 INFO [,63823dabe8475ad8d31ec1fc81853dcc,d31ec1fc81853dcc] 1848 --- [nio-8080-exec-1] com.example.demomvc.DemoMvcApplication : home() has been called
Issue Analytics
- State:
- Created 10 months ago
- Reactions:12
- Comments:30 (11 by maintainers)
Top Results From Across the Web
Spring Boot 3 Webflux application with Micrometer Tracing not ...
I'm replacing Spring Cloud Sleuth to generate log correlation with the new Micrometer Tracing for Spring Boot 3.
Read more >Get Current Trace ID in Spring Cloud Sleuth - Baeldung
In this article, we'll take a look at Spring Cloud Sleuth and see how we can use it for tracing in Spring Boot....
Read more >Spring Boot and Tracing Calls - The Blog of Ivan Krizsan
The trace id from the request to the circle resource is preserved but a new span id is generated for the request to...
Read more >Spring Cloud Sleuth
The initial span that starts a trace is called a root span . The value of the ID of that span is equal...
Read more >spring-cloud/spring-cloud-sleuth - Gitter
I have created 2 simple projects with one rest controller to have traceid & spanid in logs: Using spring-boot-starter-webflux:2.4.3, ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
For now, if you want to have the loggers have correlated MDC context, then yes, it will require some work. Because you could instead of doing
doOnNextjust calltap()orhandle()and then you’ll get the MDC correlated for you.I’m in touch with @OlegDokuka and the reactor team to work on something more automated that would resemble how Sleuth worked but would be more performant and less buggy. But that will take some time.
@marcingrzejszczak Ok thank you. Last question: So this means that I can use the function:
in any place in my Spring Boot code and the Reactor context will have the correct values so that trace and span id will be included in the logs?