Member-only story
Observability in Spring Boot 3 With AOP, Micrometer, and Zipkin
Hands-on tutorial on how to trace web requests in a Spring Boot application
Observability can help you identify issues and debug problems in your application by providing visibility into the various components and interactions that make up your system.
You need access to your application’s metrics, logs, and traces to achieve observability. You’ll gain a more detailed view of performance, response time, request flow, etc.
Spring Observability is a new feature in Spring Boot 3 that utilizes Micrometer and Micrometer Tracing. It auto-configures Micrometer Tracing and supports providers like OpenTelemetry and Zipkin.
In this tutorial, I’ll show you how to integrate Spring AOP (Aspect Oriented Programming) with Micrometer and Zipkin to achieve observability.
Let’s get started!
Project Setup
Dependencies
I’m using Maven for this demo. First, let’s install the necessary dependencies in the pom.xml
:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<version>3.0.5</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<version>3.0.5</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
<version>3.0.5</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>3.0.5</version>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-tracing</artifactId>
<version>1.0.3</version>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-tracing-bridge-otel</artifactId>
<version>1.0.0-M8</version>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-exporter-zipkin</artifactId>
<version>1.25.0</version>
</dependency>
io.micrometer:micrometer-tracing-bridge-otel
— required to…