Micrometer Tracing provides a bridge/facade to instrument your Spring Boot JVM-based application code with OpenTelemetry or Brave Tracing, which gets collected and exported to Zipkin for trace view.
Distributed Tracing of Spring Boot App using Micrometer, Brave And Zipkin

Distributed Tracing For Spring Boot 3x App Using Micrometer, Brave And Zipkin

Amith Kumar

--

Please check preface of my another blog for initial insight on Micrometer Tracing and it’s succession of Spring Cloud Sleuth:

Spring Boot 3x App — Enable Distributed Tracing using Micrometer, OpenTelemetry And Jaeger

This blog will give you a full overview of the minimal configuration required to enable any Spring Boot app with Distributed Tracing capability using the following toolsets:

  • Micrometer — For code instrumentation & provide tracing bridge to OpenZipkin Brave.
  • Brave — Distributed tracing Instrumentation library supporting both W3C & B3 trace context and propagation formats.
  • ZipkinFor visualizing, monitoring & troubleshooting distributed systems micro-service traces.

First, we will understand the dependencies required for spring boot auto configuration to take place.

NOTE: For Gradle/Maven dependencies, since we are using all spring BOM managed dependencies, so <version> tag is not used, unless you want to override to specific version. Check all the latest of versions managed by Spring BOM.
https://docs.spring.io/spring-boot/docs/current/reference/html/dependency-versions.html

For Brave integration, we’ll look at Boot 3 BraveAutoconfiguration and ZipkinConfigurations.BraveConfiguration classes, which auto-configures Distributed Tracing of our app, based on available dependencies in the classpath.

Spring Boot BraveAutoConfiguration class code showing auto configuration of Micrometer tracing with Brave based on dependencies available on the classpath.
Spring Boot BraveAutoConfiguration Class
Spring Boot ZipkinConfigurations BraveConfiguration class code showing auto configuration of Zipkin Span Exporter / Reporter based on dependencies available on the classpath.
Spring Boot ZipkinConfigurations.BraveConfiguration Class

Notice their conditional reliance on the Micrometer BraveTracer class & other Zipkin classes including ZipkinSpanHandler, so we will add the following dependencies.

#build.gradle
implementation 'io.micrometer:micrometer-tracing-bridge-brave'
implementation 'io.zipkin.reporter2:zipkin-reporter-brave'

micrometer-tracing-bridge-braveprovides micrometer bridge/facade to Brave tracing. It also transitively…

--

--