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