dotnet-cqrs/docs/observability/logging/correlation-ids.md

398 B

Correlation IDs

Distributed tracing with correlation IDs.

Usage

using (CorrelationContext.Begin(correlationId))
{
    _logger.LogEventPublished(eventId, eventType, streamName, CorrelationContext.Current);
    await ProcessAsync();
}

Propagation

Correlation IDs automatically propagate across async boundaries via AsyncLocal.

See Also