By Peter Nylander 2024
This is the repo for the talk "Introduction to OpenTelemetry in .NET" by Peter Nylander at the .NET Skåne user group event 24/4 2024.
The talk is a simple introduction how to get started with OpenTelemetry in .NET.
The repo is structured like so that each commit represents one step of the presentation
- Creating the web api that we are going to use for rest of the talk
- Logging
- Standard metrics
- Custom metrics
- Tracing
- Tracing -> Downstream api
- Custom tracing
- Custom tracing - add tag to span
- Custom tracing - add events to span
During the talk I used the .NET Aspire dashboard to easily demonstrate how to view logs, metrics and traces.
Start the dashboard by executing the following command:
docker run --rm -it -p 18888:18888 -p 4317:18889 -d --name aspire-dashboard -e DOTNET_DASHBOARD_UNSECURED_ALLOW_ANONYMOUS='true' mcr.microsoft.com/dotnet/nightly/aspire-dashboard:8.0.0-preview.5
You can also run Grafana LGTM as the OpenTelemetry backend. I also showed this briefly.
Start Grafana by executing:
docker run -p 3000:3000 -p 4317:4317 -p 4318:4318 --rm -ti grafana/otel-lgtm