Roadmap › Microservices & System Design with .NET › Module: Running Microservices in Production
Lessons in this course (9)

8. Observability — logs, metrics and distributed traces

Intermediate★ Must knowLesson 8 of 9
SignalAnswers.NET tooling
LogsWhat happened in this service?ILogger, Serilog, structured logging
MetricsHow much/how fast/how many errors?System.Diagnostics.Metrics, Prometheus, Azure Monitor
TracesWhere did time go across services?ActivitySource, OpenTelemetry, Jaeger, App Insights
csharp
builder.Services.AddOpenTelemetry()
    .WithTracing(t => t.AddAspNetCoreInstrumentation().AddHttpClientInstrumentation().AddSqlClientInstrumentation().AddOtlpExporter())
    .WithMetrics(m => m.AddAspNetCoreInstrumentation().AddRuntimeInstrumentation().AddOtlpExporter());

The trace id flows automatically through HttpClient and most message libraries (W3C Trace Context), so one request can be followed across every service. .NET Aspire wires OpenTelemetry, health checks, resilience and service discovery by default (AddServiceDefaults()) and shows everything in its dashboard.

Golden signals to alert on: latency, traffic, errors, saturation.