This project demonstrates distributed tracing in a microservices architecture using Jaeger and OpenTracing. It consists of three services (Service A
, Service B
, and Service C
) that communicate with each other, and traces are collected and visualized using Jaeger.
- Project Overview
- Technologies Used
- Prerequisites
- Setup and Installation
- Running the Project
- Viewing Traces in Jaeger UI
- Project Structure
This project simulates a microservices environment where:
- Service A calls Service B.
- Service B calls Service C.
- Each service is instrumented with OpenTracing to generate traces.
- Traces are collected and visualized using Jaeger.
The project also includes a Docker Compose setup to run Jaeger, Elasticsearch, and Kibana for trace storage and visualization.
- Go (Golang) for building microservices.
- OpenTracing for distributed tracing.
- Jaeger for trace collection and visualization.
- Docker Compose for container orchestration.
- Elasticsearch for trace storage.
- Kibana for log visualization (optional).
Before running the project, ensure you have the following installed:
-
Docker and Docker Compose:
-
Go (optional, if you want to run the services locally without Docker):
- Clone the repository:
git clone https://github.com/khpcoding/Distributed-Tracing-with-Jaeger-and-Go.git cd Distributed-Tracing-with-Jaeger-and-Go
-
Jaeger (UI at http://localhost:16686)
-
Elasticsearch (for trace storage)
-
Kibana (optional, for log visualization at http://localhost:5601)
-
Service A, Service B, and Service C.
Once the services are up and running, you can interact with them as follows:
1- Service A is available at http://localhost:8080/service-a.
2- Service B is available at http://localhost:8081/service-b.
3- Service C is available at http://localhost:8082/service-c.
To trigger a trace, simply make a request to Service A:
curl http://localhost:8080/service-a
This will initiate a chain of requests:
Service A → Service B → Service C.
Viewing Traces in Jaeger UI
1- Open the Jaeger UI in your browser:
http://localhost:16686
2- Search for traces by selecting the service name (serviceA, serviceB, or serviceC) and clicking Find Traces.
3- You can visualize the entire request flow, including the time taken by each service and the relationships between them.