Skip to content

Latest commit

 

History

History
43 lines (30 loc) · 1.46 KB

File metadata and controls

43 lines (30 loc) · 1.46 KB

Host Resource Detectors

NuGet version badge NuGet download count badge

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.ResourceDetectors.Host package to be able to use the Host Resource Detectors.

dotnet add package OpenTelemetry.ResourceDetectors.Host --prerelease

Usage

You can configure Host resource detector to the TracerProvider with the following example below.

using OpenTelemetry;
using OpenTelemetry.ResourceDetectors.Host;

var tracerProvider = Sdk.CreateTracerProviderBuilder()
                        // other configurations
                        .ConfigureResource(resource => resource
                            .AddDetector(new HostDetector()))
                        .Build();

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

  • HostDetector: host.name.

References