This project demonstrates how we can enable distributed request tracing in a Spring Boot application with Micrometer Tracing and OpenTelemetry.
The sample application includes two main services:
-
Order Service
-
Payment Service
The workflow of the application is as follows:
-
A client places an order through the Order Service via an HTTP call.
-
The Order Service processes the order and calls the Payment Service asynchronously over Kafka to handle the payment.
-
The Payment Service listens on the
order-events
topic to process the payments. -
Upon processing the payment, the Payment Service calls the Order Service via an HTTP call to update the order status.
Before you can run the application, ensure you have the following installed:
-
JDK 21 or higher
-
Docker
Start the required external dependencies: This will spin up a Kafka cluster to facilitate async communication, a UI for accessing the cluster operations, and a Jaeger instance to collect the spans.
cd .docker
docker compose up
Start the Order Service:
./mvnw spring-boot:run -pl order-service
Start the Payment Service:
./mvnw spring-boot:run -pl payment-service
After that, navigate to the http://localhost:8081/swagger-ui/index.html#/order-controller/placeOrder
endpoint to place a dummy order.
Then, navigate to http://localhost:16686
to access the Jaeger UI and see the full request path across the services.