Skip to main content

Documentation Index

Fetch the complete documentation index at: https://ancplua.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Source: Al0092ConsiderSamplingAnalyzer.cs

Description

High-volume services should configure a sampler to control the volume and cost of telemetry data. Without sampling, trace storage costs can grow unbounded.

Bad Code

builder.Services.AddOpenTelemetry()
    .WithTracing(t => t.AddOtlpExporter());
// No sampler configured - defaults to AlwaysOn

Good Code

builder.Services.AddOpenTelemetry()
    .WithTracing(t => t
        .SetSampler(new TraceIdRatioBasedSampler(0.1))
        .AddOtlpExporter());

Properties

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

Configuration

dotnet_diagnostic.AL0092.severity = suggestion