Skip to content

Latest commit

 

History

History
38 lines (27 loc) · 2.33 KB

File metadata and controls

38 lines (27 loc) · 2.33 KB

04-spring-classic-simple

This project is showcasing Micrometer APIs using classic thread-per-request approach.

How does it work?

io.micrometer:micrometer-tracing

  • defines io.micrometer.tracing.handler.TracingObservationHandler that reacts to Observation lifecycle
  • implements multiple versions of TracingObservationHandler, e.g. PropagatingReceiverTracingObservationHandler

io.micrometer:micrometer-tracing-bridge-brave

  • a library implementing a set of abstractions from io.micrometer:micrometer-tracing via delegating to Brave tracer
  • when this library is on the classpath, org.springframework.boot:spring-boot-actuator-autoconfigure will set up tracing via Brave
  • autoconfiguration is done by org.springframework.boot.actuate.autoconfigure.tracing.BraveAutoConfiguration
  • while also more configuration is loaded from org.springframework.boot.actuate.autoconfigure.tracing.BravePropagationConfigurations
  • BraveAutoConfiguration sets up ThreadLocalCurrentTraceContext to allow for context propagation based on thread-locals
  • and BravePropagationConfigurations will take care of adding MDCScopeDecorator to Brave Tracer

io.micrometer:micrometer-tracing-bridge-otel

  • bridges to Otel tracer instead of Brave
  • contains more code overall compared to Brave bridge (due to bigger diff between APIs)
  • adding Baggage values to MDC is handled by Slf4JBaggageEventListener

HelloControllerV1

  • Observation is created by org.springframework.web.filter.ServerHttpObservationFilter
  • PropagatingReceiverTracingObservationHandler reacts to Observation getting created and creates a span via Tracer
  • Observation is then put into scope by ServerHttpObservationFilter
  • PropagatingReceiverTracingObservationHandler reacts to it and makes the associated span "current"