Monitor your API endpoints using Zipkin in a Spring Boot 3 application
To implement Zipkin in a Spring Boot application and run it using Docker Compose, follow these steps:
Step 1: Create a
docker-compose.yml file with the following contents:
This file defines a service named “zipkin” that uses the official Zipkin Docker image and exposes port 9411 for the Zipkin UI and HTTP API.
Step 2: Add the necessary dependencies to your project’s
<!-- Other dependencies -->
These dependencies are required for integrating Zipkin with your Spring Boot application.
Step 3: Configure your application by adding the following properties to the
# Zipkin configuration
spring.zipkin.base-url property specifies the URL where Zipkin is running (in this case, http://localhost:9411/). The
spring.sleuth.sampler.probability property sets the sampling probability to 100% to ensure all requests are traced.
Step 4: Run the Zipkin server using Docker
docker-compose.yml file is located, and run the following command:
This will start the Zipkin server in a Docker container.
Once you have implemented and configured Zipkin in your Spring Boot application, you can run it alongside other microservices. Zipkin will collect and display distributed traces, allowing you to analyze the flow of requests across your system.
Happy coding :)
GitHub Source Zipkin : https://github.com/openzipkin/zipkin/blob/master/docker/examples/docker-compose-kafka.yml