-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Labels
enhancementNew feature or requestNew feature or requestfeatureThis label is in use for minor version incrementsThis label is in use for minor version increments
Milestone
Description
Title: Add OpenTelemetry tracing behaviors via System.Diagnostics.Activity
Labels: enhancement, mediator, new-package
Body:
Problem
The built-in logging behaviors use ILogger with Stopwatch for timing. Modern .NET applications expect distributed tracing via System.Diagnostics.Activity and OpenTelemetry. Without this, Cortex.Mediator operations are invisible in distributed traces.
Proposed Solution
Create a Cortex.Mediator.OpenTelemetry package:
- Define an
ActivitySourcenamedCortex.Mediator TracingCommandBehavior<TCommand, TResult>-- starts an Activity span for command executionTracingQueryBehavior<TQuery, TResult>-- same for queriesTracingNotificationBehavior<TNotification>-- same for notifications- Tags:
mediator.message.type(command/query/notification),mediator.message.name,mediator.handler.name,mediator.result.status(success/failure) - Set Activity status to Error on exceptions
Registration:
options.AddOpenTelemetryBehaviors();
// In OpenTelemetry configuration:
builder.Services.AddOpenTelemetry()
.WithTracing(tracing => tracing.AddSource("Cortex.Mediator"));Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestfeatureThis label is in use for minor version incrementsThis label is in use for minor version increments