3

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?

Ihor M.
  • 2,728
  • 3
  • 44
  • 70

2 Answers2

5

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

bilak
  • 4,526
  • 3
  • 35
  • 75
0

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.

Jonatan Ivanov
  • 4,895
  • 2
  • 15
  • 30
  • That's the thing, that I am inside of the controller method, I am outputting the MDC map and it is null. – Ihor M. May 18 '21 at 20:22