The aim of this repository, is to show how you can integrate distributaed tracing into your .NET based API app and worker service, using OpenTelemetry.
To collect tracing data, instead of directly sending data to Jager, an OTEL collector container is configured which then acts as a mediator to export trace data to Jager or whatever collector you would like to use.
In this way, when you configure exporter, you do not care about the type or protocol, because the OTEL collector will take care of it.
This is a shared library that is responsible to configure logging and tracing. This way the tracing and logging is abstracted.
Containt the message that will be send from API and be processed by worker service.
It has a simple controller to use MassTransit send method and put the message in the queue.
A configured MassTransit exist in the project to recieve all the messsages in the queue and process them.
Open the http://localhost:16686/search in browser and find the service you want to see its traces. Click on "Find traces" and you dig deep into each trace.
I could not find an easy to configure free log management tool, so I stick to Console Exporter, therefore you can see the logs by opening either "Tracing.WebAapi" or "Tracing.WorkerService" container, then navigate to "Logs" to see the logs.
You need Visual Studio 2022 and Dokcer Desktop. After the solution loaded, run it using "Docker Compose" option.
An important note: I did not use MassTransit instrumention because the latest version (8) already has all the configuration, and you just need to call AddSource so the MAssTransit event can be traced. Read more : open-telemetry/opentelemetry-dotnet-contrib#326