This set of projects is an example distributed application comprised of two components:
- An ASP.NET Core Web API
- A background Worker Service
The application demonstrates a number of OpenTelemetry concepts:
- OpenTelemetry APIs for distributed context propagation.
- Basic conventions of how messaging systems are handled in OpenTelemetry.
The Web API publishes messages to RabbitMQ which the Worker Service consumes. Distributed context propagation is achieved using OpenTelemetry APIs to inject and extract trace context in the headers of the published messages.
The Zipkin exporter is configured for viewing the distributed traces.
A running instance of RabbitMQ and Zipkin are required. These can easily be spun up in docker containers.
The WebApi
and WorkerService
projects can be run from this directory as
follows:
dotnet run --project WebApi
dotnet run --project WorkerService
Instead of running the projects individually, if you are using Docker Desktop,
a docker compose
file is provided. This makes standing up the Zipkin and
RabbitMQ dependencies easy, as well as starting both applications.
To run the example using docker compose
, run the following from this
directory:
docker compose up --build
With everything running:
- Invoke the Web API to send a message.
- If you have run RabbitMQ and Zipkin with default settings:
- Manage RabbitMQ by accessing the local endpoint
http://localhost:15672/
- user = guest
- password = guest
- View your traces with Zipkin by accessing the local endpoint http://localhost:9411/zipkin.
- Manage RabbitMQ by accessing the local endpoint
http://localhost:15672/