We are facing an issue with spring boot 3.3.1, TraceContext is lost in between while processing the micrometer tracer object

java.lang.NullPointerException: Cannot invoke "io.micrometer.tracing.Span.context()" because the return value of "io.micrometer.tracing.Tracer.currentSpan()" is null

Our Observation When we call an api in microservice 1, tracer.currentSpan().context() is available but while trying to extract the traceId from TraceContext we are not getting the value

Sample projects

https://github.com/tadlakha9/micro1 https://github.com/tadlakha9/micro2

actually when we call an api, we get the tracer with currentSpan later currentSpan got lost in between. We have similar issue in the past as well.

  • https://github.com/spring-projects/spring-boot/issues/34622#issuecomment-1474042560
  • https://github.com/spring-projects/spring-boot/issues/38615

Comment From: bclozel

Duplicates #42031 - we will consider your comment there, no need to create duplicate issues.