Currently we require the users to make the ContextRegistry.getInstance().registerThreadLocalAccessor(new ObservationAwareSpanThreadLocalAccessor(tracer)) call automatically. The problem is that if you have tests you might have different tracers, so most likely we would need another TestExecutionListener that would do somewhat similar work with updating the ObservationAwareSpanThreadLocalAccessor to contain the proper tracer.

related issue https://github.com/micrometer-metrics/micrometer/issues/3908

Comment From: philwebb

Might it be better to try and solve this in Micrometer itself? Perhaps ThreadLocalAccessor implementations could implement some additional interface if they want before/after ordering?

Comment From: marcingrzejszczak

Yeah, that could be also the case. I've created an issue in Context Propagation library - https://github.com/micrometer-metrics/context-propagation/issues/120

Comment From: wilkinsona

I'm going to close this one in favor of the context propagation issue. We can re-open if it turns out the changes are required in Boot but I think it would be better to fix this at source in context propagation if at all possible. That way, the fix will be of benefit to everyone, not just those who are using context propagation with Spring Boot.