Configuration

The environment variables that configure the Dash0 OpenTelemetry .NET distribution.

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

The distribution is configured with environment variables, or with a configuration file. Every variable in the upstream configuration reference  works as documented there. Only the default of OTEL_PROPAGATORS differs from upstream, see Propagators. This page lists the variables that are needed most often.

Installation directory

VariableDescription
OTEL_DOTNET_AUTO_HOMEAbsolute path to the extracted distribution directory. When it is not set, instrument.sh uses $HOME/.otel-dotnet-auto. We recommend setting it, before you source instrument.sh.

Dash0 environment variables

VariableEffect
DASH0_OTEL_COLLECTOR_BASE_URLSets the OTLP endpoint, unless OTEL_EXPORTER_OTLP_ENDPOINT is set.
DASH0_DISABLESet to true to turn the distribution off completely.
DASH0_AUTOMATIC_SERVICE_NAMESet to false to stop the distribution from setting service.version from the application.

DASH0_BOOTSTRAP_SPAN, DASH0_FLUSH_ON_SIGTERM_SIGINT, DASH0_DEBUG and DASH0_DEBUG_PRINT_SPANS from the other Dash0 distributions are not supported.

DASH0_OTEL_COLLECTOR_BASE_URL

Set it to the base URL of your collector or of the Dash0 ingress, such as http://localhost:4318. A trailing slash in the value is removed.

It is a default, so OTEL_EXPORTER_OTLP_ENDPOINT on the workload overrides it. That lets you set one endpoint for a whole host and still send a single workload somewhere else.

DASH0_DISABLE

Set DASH0_DISABLE=true to turn the distribution off before it loads anything, so the application runs without any instrumentation. Only the value true counts, in any case.

OTEL_SDK_DISABLED=true is different: it stops the export of telemetry, but the instrumentation stays loaded.

DASH0_AUTOMATIC_SERVICE_NAME

When no service name is set, the distribution sets service.name and service.version from the application's entry assembly. How the service name is chosen describes the order, and what DASH0_AUTOMATIC_SERVICE_NAME=false turns off.

Service identity and resource attributes

VariableDescription
OTEL_SERVICE_NAMESets the service.name resource attribute. The Dash0 operator sets it from the workload metadata.
OTEL_RESOURCE_ATTRIBUTESAdditional resource attributes as comma-separated key=value pairs.

The distribution also adds the attributes of the upstream resource detectors, for example for the process, the host, and the OpenTelemetry SDK, and the telemetry.distro.name and telemetry.distro.version attributes. Resource detection lists them, with and without a configuration file.

Export

VariableDescription
OTEL_EXPORTER_OTLP_ENDPOINTBase URL of the OTLP endpoint. The Dash0 operator points it at the collector in the cluster.
OTEL_EXPORTER_OTLP_PROTOCOLhttp/protobuf (default) or grpc.
OTEL_EXPORTER_OTLP_HEADERSAdditional OTLP headers, for example Authorization=Bearer <token> to export directly to Dash0.
OTEL_TRACES_EXPORTER, OTEL_METRICS_EXPORTER, OTEL_LOGS_EXPORTERExporter per signal. Set to none to turn off the export of one signal.

Propagators

VariableDescription
OTEL_PROPAGATORSComma-separated list of propagators: tracecontext, baggage, b3multi, b3, and xray. The default is tracecontext,baggage,xray. Upstream's default is tracecontext,baggage.

With the default, outgoing requests carry the AWS X-Amzn-Trace-Id header as well as the W3C traceparent header. This keeps one trace across AWS load balancers, which read and write X-Amzn-Trace-Id.

When an incoming request carries both valid headers, the X-Amzn-Trace-Id context wins. That can attach a span to the wrong parent when a proxy in front of the application writes a new traceparent but forwards an older X-Amzn-Trace-Id unchanged. If spans are parented to the wrong service, go back to traceparent alone:

export OTEL_PROPAGATORS=tracecontext,baggage

An X-Amzn-Trace-Id header with only a Root field, which is what an AWS load balancer adds to a request that arrived without one, is ignored, and the traceparent context is kept. The X-Ray context wins wherever xray is in the list, so reordering the list does not change which context is used. Leaving xray out is the only way to make traceparent win.

With a configuration file (OTEL_CONFIG_FILE), the propagators come from the file's propagator section, and the default applies only when the file has no propagator section.

Instrumentations

All instrumentations are enabled by default. Use the following variables to restrict them:

VariableDescription
OTEL_DOTNET_AUTO_TRACES_ENABLED_INSTRUMENTATIONSComma-separated list of the trace instrumentations to enable. When it is not set, all are enabled.
OTEL_DOTNET_AUTO_METRICS_ENABLED_INSTRUMENTATIONSThe same, for metrics.
OTEL_DOTNET_AUTO_LOGS_ENABLED_INSTRUMENTATIONSThe same, for logs.

The names of the instrumentations are listed in the upstream instrumentation reference .

Turning off and troubleshooting

VariableDescription
DASH0_DISABLESet to true to turn the distribution off completely, see Dash0 environment variables.
OTEL_DOTNET_AUTO_LOG_DIRECTORYDirectory for the diagnostic logs of the distribution itself.
OTEL_LOG_LEVELLevel of the diagnostic logs: none, error, warn, info (default), or debug.

To remove the instrumentation completely, start the application without the variables that instrument.sh sets.

Configuration file

Instead of environment variables, the instrumentation can be configured with an OpenTelemetry declarative configuration file in YAML. The distribution picks the file as follows:

  1. The file that OTEL_CONFIG_FILE names, when the variable is set and not empty. If that file does not exist, no telemetry is exported, and the error is written only to the instrumentation log.
  2. Otherwise, /etc/opentelemetry/dotnet/otel-config.yaml, when it exists.
  3. Otherwise, no file is used, and the environment variables configure the instrumentation.

OTEL_EXPERIMENTAL_FILE_BASED_CONFIGURATION_ENABLED overrides this choice when it is set: true always uses a file, and any other value, such as false, never does.

A file replaces most OTEL_* variables. A few, such as OTEL_DOTNET_AUTO_HOME and the attribute limits, are still read from the environment. The file-based configuration reference  lists them and describes the file format.

DASH0_DISABLE applies with a file too. DASH0_OTEL_COLLECTOR_BASE_URL applies only if the file refers to ${OTEL_EXPORTER_OTLP_ENDPOINT}.

Last updated: