OpenTelemetry vs Micrometer vs Spring Sleuth — Choosing the Right Library
Fast recall
Quick revision
Core answer
Awareness of the Java observability ecosystem and how the libraries relate to each other.
Thinking OpenTelemetry replaces Micrometer for metrics — in Spring Boot 3, Micrometer integrates with OTel rather than being replaced by it.
Explain that Micrometer 1.10+ added a Tracing API that can be backed by either OTel or Brave (Zipkin), unifying metrics and tracing under one facade.
Interview-ready guide
Interview answer
Micrometer, Spring Cloud Sleuth, and OpenTelemetry operate at different layers — they're partly complementary and partly overlapping in scope. Understanding which handles what prevents duplicate instrumentation and configuration conflicts.
Micrometer — metrics
- Micrometer is the metrics facade for Spring Boot — it defines the
Counter,Timer, andGaugeinstruments and publishes to backends like Prometheus, CloudWatch, and Stackdriver - Micrometer has no tracing capability; it handles only metrics; in Spring Boot 2.x, Sleuth adds tracing separately; in Spring Boot 3, Micrometer expanded to include tracing via
micrometer-tracing
Spring Cloud Sleuth — tracing for Spring Boot 2.x
- Sleuth auto-instruments HTTP, Kafka, and Spring Data calls and propagates trace context through Spring's infrastructure
- Sleuth is deprecated and not available for Spring Boot 3 — for Spring Boot 3, use
micrometer-tracing-bridge-brave(Zipkin/Jaeger Brave-format) ormicrometer-tracing-bridge-otel(OpenTelemetry format)
OpenTelemetry — the vendor-neutral standard
- OpenTelemetry is a CNCF standard that defines APIs for traces, metrics, and logs — the goal is one instrumentation API that works with any backend (Jaeger, Zipkin, Prometheus, Datadog, Honeycomb) by swapping the exporter
- The OpenTelemetry Java agent auto-instruments Java applications without any code changes — attach
-javaagent:opentelemetry-javaagent.jarand configure the exporter; it instruments Spring, JDBC, HTTP clients, Kafka, and more - The trade-off: the OTel agent is heavier than Micrometer's lightweight registry approach; configuration is via environment variables rather than Spring's
application.properties
In practice for Spring Boot
- Spring Boot 3: use Micrometer for metrics,
micrometer-tracingfor traces; these integrate with Spring's auto-configuration; use OTel agent when you need vendor-neutral instrumentation across non-Spring components in the same JVM
OpenTelemetry vs Micrometer vs Spring Sleuth — Choosing the Right Library
Direct Answer
Micrometer handles metrics, Sleuth (replaced by Micrometer Tracing in Boot 3) handles traces, and OpenTelemetry is the vendor-neutral standard that covers metrics, traces, and logs in one SDK. For new Spring Boot 3 projects, use Micrometer Tracing backed by the OTel SDK.
Common Mistakes & Pitfalls
Thinking OpenTelemetry replaces Micrometer for metrics — in Spring Boot 3, Micrometer integrates with OTel rather than being replaced by it.
Check your understanding
Answer these without looking back at the article.
- What is the OpenTelemetry Collector and why would you use it?
- How does Micrometer Tracing bridge to the OpenTelemetry SDK?
- What are the trade-offs of using the OTel Java agent vs manual instrumentation?
Related interview prep categories
1Looking for a structured roadmap?
Every module on this page is also part of the full Java backend interview track.