Repository navigation
2.2.0
Tracing and metrics
AnyMediator now emits OpenTelemetry-compatible spans and a duration histogram through .NET's own ActivitySource and Meter. No new dependency, no behavior change, and nothing is recorded until you subscribe:
builder.Services.AddOpenTelemetry()
.WithTracing(t => t.AddSource(AnyMediatorDiagnostics.ActivitySourceName))
.WithMetrics(m => m.AddMeter(AnyMediatorDiagnostics.MeterName));- Spans:
send {Request},create_stream {Request}(open until the stream is read, fails or is abandoned),publish {Notification}with onehandle {Notification}child per handler. Attributesanymediator.operation,anymediator.message.type,anymediator.handler.type; failures setErrorstatus,error.typeand anexceptionevent. - Metric:
anymediator.operation.durationhistogram, in seconds, by operation, message type anderror.type. - New:
AnyMediatorDiagnostics.ActivitySourceNameandAnyMediatorDiagnostics.MeterName.
Cost
| Not listening | Listening | |
|---|---|---|
Send (1 span) |
87 ns, 96 B | 564 ns, 704 B |
Publish, 3 handlers (4 spans) |
307 ns, 632 B | 2,310 ns, 2,872 B |
Guide: Tracing and metrics
What's Changed
Full Changelog: 2.1.1...2.2.0