Status | |
---|---|
Stability | Alpha |
Code Owners | @Kielek, @lachmatt |
Important
Resources detected by this packages are defined by experimental semantic convention. These resources can be changed without prior notification.
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
You can configure Operating System resource detector to the ResourceBuilder
with the following example.
usingOpenTelemetry;usingOpenTelemetry.Resources;usingvartracerProvider=Sdk.CreateTracerProviderBuilder().ConfigureResource(resource =>resource.AddOperatingSystemDetector())// other configurations.Build();usingvarmeterProvider=Sdk.CreateMeterProviderBuilder().ConfigureResource(resource =>resource.AddOperatingSystemDetector())// other configurations.Build();usingvarloggerFactory=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
.