Reproducible example: https://github.com/OlegHudyma/spring-boot-webflux-mongodb-tracing-issue-4-10-2023
🐞 Bug report
TraceID and SpanID are dropped from MDC context (probably observation context it dropped as well, but tested with logs only), after calling save from ReactiveMongoRepository.
00000000000000000000000000000000:0000000000000000 is displayed instead in rest of pipeline steps.
Version: Spring Boot 3.0.5 Dependencies: - Webflux - Data MongoDB Reactive - Acutator - Micrometer - Micrometer Context Propagation
This example also uses Hooks.enableAutomaticContextPropagation()
Logs:
2023-04-10T11:51:46.030+03:00 INFO --- [f4fbd3c02aa3e886c4d56dfe24a78c81:94b0f7109c97a2a6] [reactor-http-nio-6] c.e.s.controller.EntityController : Request received 2023-04-10T11:51:46.030+03:00 INFO --- [f4fbd3c02aa3e886c4d56dfe24a78c81:94b0f7109c97a2a6] [reactor-http-nio-6] c.e.s.controller.EntityController : Fetching entity 2023-04-10T11:51:46.036+03:00 INFO --- [f4fbd3c02aa3e886c4d56dfe24a78c81:94b0f7109c97a2a6] [nioEventLoopGroup-3-3] c.e.s.controller.EntityController : Creating entity 2023-04-10T11:51:46.042+03:00 INFO --- [00000000000000000000000000000000:0000000000000000] [nioEventLoopGroup-3-3] c.e.s.controller.EntityController : Created entity 2023-04-10T11:51:46.042+03:00 INFO --- [00000000000000000000000000000000:0000000000000000] [nioEventLoopGroup-3-3] c.e.s.controller.EntityController : Request processed
Comment From: oleh-hudyma
Issue raised in spring-data as well: https://github.com/spring-projects/spring-data-mongodb/issues/4360
Comment From: wilkinsona
Please don't raise the same issue in multiple places as it is likely to result in duplicate, wasted effort. I am going to close this in favor of the Spring Data issue as the observability of Spring Data repositories is a Spring Data feature.