Skip to main content
PreparationZone Logo
PrepZone

Micrometer Tracing (replaces Sleuth)

OpenTelemetry integration, trace propagation and log correlation.

Pass checkpoint below

Why this matters

  • A slow checkout might spend 400 ms in inventory, 2 seconds in payment, and 50 ms in your API — logs alone cannot show where the time went across service boundaries.
  • Micrometer Tracing replaced Spring Cloud Sleuth in Boot 3.x; it uses OpenTelemetry under the hood and propagates trace context through HTTP headers and message metadata.
  • Correlating traces with logs (same trace ID in MDC) turns a Grafana trace view into a jump-off point for the exact log lines on each hop.

Traces and spans

L1 · Fresher

Each HTTP call becomes a trace; downstream JDBC and Kafka calls become child spans for latency breakdown.

Micrometer Tracing

L2 · Intermediate

Boot 3 uses Micrometer with OpenTelemetry bridges — Spring Cloud Sleuth is retired.

Propagation headers

L3 · Advanced

W3C traceparent headers carry context across BookStore services and message consumers.

Sampling strategy

L4 · Expert

Head-based sampling in prod keeps overhead low; always record errors and slow traces for debugging.

Tracing stack in Boot 3.4

  • Micrometer Tracing — abstraction layer; bridges to OpenTelemetry or Brave exporters.
  • OpenTelemetry SDK — vendor-neutral instrumentation and export to Jaeger, Zipkin, or OTLP collectors.
  • traceId / spanId — identifiers propagated across services; inject into MDC for log correlation.
  • ObservationRegistry — creates spans around HTTP requests, @Scheduled jobs, and custom code.
  • OTLP exporter — sends spans to Grafana Tempo, Honeycomb, or any OpenTelemetry-compatible backend.
Logs
Logback + MDCStructured JSON
Metrics
MicrometerCounters, timers
Traces
OpenTelemetryTrace propagation
Logs, metrics and traces — the three pillars wired through Actuator and Micrometer.

Dependencies and configuration

Java
<dependency>
    <groupId>io.micrometer</groupId>
    <artifactId>micrometer-tracing-bridge-otel</artifactId>
</dependency>
<dependency>
    <groupId>io.opentelemetry</groupId>
    <artifactId>opentelemetry-exporter-otlp</artifactId>
</dependency>

The rest of this guide is part of Pro

Free covers every fresher guide in full. Pro unlocks Senior, Staff and Architect guides across every track.

Still to come · 2 sections

  • Automatic instrumentation
  • Kafka trace propagation

Test yourself

Answer these before moving on — recall is what makes it stick.