Skip to main content
Source: Al0063UnregisteredActivitySourceAnalyzer.cs

Description

An ActivitySource that is not registered via AddSource() in the tracing configuration will silently drop all spans.

Bad Code

private static readonly ActivitySource Source = new("MyService");
// But tracing setup never calls .AddSource("MyService")

Good Code

private static readonly ActivitySource Source = new("MyService");

// In startup:
builder.Services.AddOpenTelemetry()
    .WithTracing(t => t.AddSource("MyService"));

Properties

  • Category: OpenTelemetry
  • Severity: Warning
  • Enabled by default: True
  • Code fix available: False

Configuration

dotnet_diagnostic.AL0063.severity = warning