practical-net-otelcollector
practical-net-otelcollector copied to clipboard
Practical .NET Observability with OpenTelemetry Collector
trafficstars
.NET with OpenTelemetry Collector
Overview
-
Use OpenTelemetry to collect traces and metrics and Serilog to collect log's messages; then all of them will only export to OpenTelemetry Collector (OTEL collector in short).
-
The collector then exports to
- Zipkin and/or Jaeger for tracings
- Prometheus for metrics
- Loki for log's messages
-
All of them are visualized on Grafana
Quick Start
- Starting infrastructure from docker compose
docker compose -f ./local/infra/docker-compose.observability.yaml up -d
- Starting service by using tye
tye run ./local/tye/tye.yaml --dashboard
- Observe
- Making some requests to
http://localhost:6002/helloor execute via Visual Studio

- Access
grafanaathttp://localhost:3000to explore 4 datasources: Jaeger, Zipkin, Prometheus & Loki




Development
Register & configure
-
Refer to ObservabilityRegistration.cs
-
There are the following methods that named as its functionality
AddTracingAddMetricsAddSerilog
-
There is only one
publicmethod which isAddObservability. This is used in Program.cs
var webApplicationBuilder = WebApplication.CreateBuilder(args);
webApplicationBuilder.AddObservability();
// Other lines of code
Give a Star! :star2:
If you liked this project or if it helped you, please give a star :star: for this repository. Thank you!!!