This project is a quick example to showcase Distributed Tracing in a Spring Boot application using Micrometer and OpenTelemetry.
There are 2 tracing scenarios - HTTP and Apache Kafka
- HTTP Service 1 makes a GET call to HTTP Service 2.
- HTTP Service 2 makes a GET call to whatthecommit.com.
- HTTP Service 2 returns the response from whatthecommit.com back to HTTP Service 1.
-
Stay on the
main
branch. -
Change to
otel-http
folder:cd otel-http
-
Compile and build the docker image of http services.
mvn spring-boot:build-image
-
Run the docker-compose setup. This will start Jaeger and the HTTP services.
docker-compose up
-
Call the httpservice1.
curl http://localhost:8080
-
Open Jaeger at
http://localhost:16686
and check the traces.
-
Switch to
spring-boot-3-opentelemetry
branch. -
Change to
otel-http
folder:cd otel-http
-
Compile and build the docker image of http services.
mvn spring-boot:build-image
-
Run the docker-compose setup. This will start Jaeger and the HTTP services.
docker-compose up
-
Call the httpservice1.
curl http://localhost:8080
-
Open Jaeger at
http://localhost:16686
and check the traces.
- Kafka Producer makes a GET call to whatthecommit.com.
- Kafka Producer produces the response from Step 1 to Apache Kafka.
- Kafka Consumer consumes the message from Apache Kafka.
- After consumption, Kafka Consumer store the record in H2 in-memory DB.
-
Stay on the
main
branch. -
Change to
otel-kafka
folder:cd otel-kafka
-
Compile and build the docker image of kafka services.
mvn spring-boot:build-image
-
Run the docker-compose setup. This will start a 1-node Kafka cluster, Jaeger and the Kafka producer/consumer services.
docker-compose up
-
Call the kafkaservice1.
curl http://localhost:8080
-
Open Jaeger at
http://localhost:16686
and check the traces.
-
Switch to
spring-boot-3-opentelemetry
branch. -
Change to
otel-kafka
folder:cd otel-kafka
-
Compile and build the docker image of http services.
mvn spring-boot:build-image
-
Run the docker-compose setup. This will start a 1-node Kafka cluster, Jaeger and the Kafka producer/consumer services.
docker-compose up
-
Call the kafkaservice1.
curl http://localhost:8080
-
Open Jaeger at
http://localhost:16686
and check the traces.