Spring Cloud Sleuth stopped pushing X-B3-TraceId into MDC after spring-boot/spring cloud upgrade

Viewed 2975

I have upgraded my Spring boot dependencies from 2.1 to 2.4.5 and spring cloud to 2020.0.2. After this upgrade, my MDC context is not populated.

Any ideas of what should be done here?

2 Answers

in spring cloud 2020.0.2 you have sleuth 3.x and there is a migration guide telling about some changes to MDC

I think the answer depends on your use-case but as far as I remember, there was a change and the MDC context is cleaned-up after the span is finished.

This means that if you are in the scope of the Span (e.g.: controller method), you can see the Sleuth-related parts of the MDC but if you are outside of the scope of the span (e.g.: Tomcat access logs), you don't.

To test this, try to log out the MDC context map inside of the controller method, the MDC context should contain the tracing-related fields.

Related