Resource Detection

The resource attributes the .NET distribution reports, how the service name is chosen, and which detectors to list in a configuration file.

Note: This page is auto-generated from the opentelemetry-dotnet-distribution  repository.

The distribution keeps every resource detector of the upstream .NET instrumentation, adds its own service name detector, and identifies itself with the telemetry.distro.* attributes. This page describes configuration from environment variables first. A host with a declarative configuration file is covered at the end.

Attributes the distribution adds

AttributeValue
telemetry.distro.namedash0-dotnet
telemetry.distro.versionThe version of this distribution

The distribution sets them itself, with or without a configuration file.

Detectors that run by default

Without a configuration file, every upstream resource detector runs:

DetectorAttributes
hosthost.* attributes, including host.id
operatingsystemos.* attributes
processprocess.* attributes, without process.command_args
processruntimeprocess.runtime.* attributes
containercontainer.id, when the process runs in a container
azureappservicecloud.* and other attributes, on Azure App Service only

Every process also reports service.instance.id. There is no detector for k8s.pod.uid.

How the service name is chosen

Without a configuration file, the first of these that is set gives the service.name:

  1. OTEL_SERVICE_NAME.
  2. service.name in OTEL_RESOURCE_ATTRIBUTES.
  3. The name of the application's entry assembly, such as MyApp for dotnet MyApp.dll.

With the entry assembly name, the distribution also sets service.version to the assembly's informational version, without the +<commit> suffix that the .NET SDK adds. It never replaces a service.name or service.version you set.

With DASH0_AUTOMATIC_SERVICE_NAME=false, the distribution sets neither attribute. service.name still falls back to the entry assembly name, because upstream does that on its own, but service.version is not set. So a process never reports unknown_service.

With a configuration file that reads OTEL_RESOURCE_ATTRIBUTES through attributes_list, the first two swap places: attributes set in the file take precedence over every detector.

Under a configuration file

When a configuration file configures the instrumentation, only the detectors the file lists under resource.detection/development.detectors run. List all of them to keep the attributes of the default detectors, and add dash0_service_name:

resource:
  detection/development:
    detectors:
      - azureappservice: {}
      - container: {}
      - host: {}
      - operatingsystem: {}
      - process: {}
      - processruntime: {}
      - dash0_service_name: {}
  attributes_list: ${OTEL_RESOURCE_ATTRIBUTES:-}

Under a configuration file, only dash0_service_name reads OTEL_SERVICE_NAME. The SDK doesn't. If OTEL_SERVICE_NAME isn't set, the detector falls back to the entry assembly name and version, as described under How the service name is chosen. Leave dash0_service_name out of the file and OTEL_SERVICE_NAME is ignored.

The Dash0 Node.js, Python and Ruby distributions also have dash0_distribution and dash0_kubernetes detectors. The .NET distribution has neither. One of those names in a .NET file is skipped with an Ignoring unknown resource detector warning in the instrumentation log, and nothing else changes.

Your own attributes

Add attributes with OTEL_RESOURCE_ATTRIBUTES, as comma-separated key=value pairs. A configuration file reads it only through attributes_list, as in the example above.

Last updated: