Operating System Detectors

November 20, 2025 ยท View on GitHub

Status
StabilityAlpha
Code Owners@Kielek, @lachmatt

NuGet version badge NuGet download count badge codecov.io

Important

Resources detected by this packages are defined by experimental semantic convention. These resources can be changed without prior notification.

Getting Started

You need to install the OpenTelemetry.Resources.OperatingSystem package to be able to use the Operating System Resource Detectors.

dotnet add package OpenTelemetry.Resources.OperatingSystem --prerelease

Usage

You can configure Operating System resource detector to the ResourceBuilder with the following example.

using OpenTelemetry;
using OpenTelemetry.Resources;

using var tracerProvider = Sdk.CreateTracerProviderBuilder()
    .ConfigureResource(resource => resource.AddOperatingSystemDetector())
    // other configurations
    .Build();

using var meterProvider = Sdk.CreateMeterProviderBuilder()
    .ConfigureResource(resource => resource.AddOperatingSystemDetector())
    // other configurations
    .Build();

using var loggerFactory = LoggerFactory.Create(builder =>
{
    builder.AddOpenTelemetry(options =>
    {
        options.SetResourceBuilder(ResourceBuilder.CreateDefault().AddOperatingSystemDetector());
    });
});

The resource detectors will record the following metadata based on where your application is running:

  • OperatingSystemDetector: os.type, os.build_id, os.description, os.name, os.version.

References