Configuration
The distribution is configured with environment variables. Alternatively, the OpenTelemetry SDK can be configured with a declarative configuration file; this page notes which settings still apply in that case.
Dash0-specific environment variables
| Variable | Default | Description |
|---|---|---|
DASH0_OTEL_COLLECTOR_BASE_URL | none | Base URL of the collector that telemetry is sent to. |
DASH0_DISABLE | false | Disables the distribution entirely. |
DASH0_AUTOMATIC_SERVICE_NAME | true | Derives the service name and version from package.json. |
DASH0_BOOTSTRAP_SPAN | none | Emits a span with this name at startup. |
DASH0_DEBUG | false | Prints debug log output. |
DASH0_DEBUG_PRINT_SPANS | false | Prints all spans to stdout. |
DASH0_ENABLE_FS_INSTRUMENTATION | false | Enables spans for file system access. |
DASH0_FLUSH_ON_EMPTY_EVENT_LOOP | true | Flushes telemetry when the event loop is empty. |
DASH0_FLUSH_ON_SIGTERM_SIGINT | false | Flushes telemetry on SIGTERM and SIGINT. |
DASH0_OTEL_COLLECTOR_BASE_URL
The base URL of the OpenTelemetry collector that the distribution sends data to, for example http://localhost:4318.
The distribution appends /v1/traces, /v1/metrics and /v1/logs to it.
This variable is required unless a declarative configuration file is used.
Without either, the distribution does not start.
When both are set, the configuration file takes precedence, and DASH0_OTEL_COLLECTOR_BASE_URL sets the default for OTEL_EXPORTER_OTLP_ENDPOINT, without trailing slashes.
A file that references ${OTEL_EXPORTER_OTLP_ENDPOINT} then exports to that collector.
An explicitly set OTEL_EXPORTER_OTLP_ENDPOINT takes precedence.
DASH0_DISABLE
Set DASH0_DISABLE=true to disable the Dash0 Node.js distribution entirely.
DASH0_AUTOMATIC_SERVICE_NAME
If no service name has been set, a service name and a service version are automatically derived from the application's main package.json file, if it is present:
- The
service.nameresource attribute is set to the value of thenameattribute inpackage.json. - The
service.versionresource attribute is set to the value of theversionattribute inpackage.json.
This behavior is disabled in any of these cases:
- An explicit service name is set with the
OTEL_SERVICE_NAMEenvironment variable. - An explicit service name is set with the
OTEL_RESOURCE_ATTRIBUTESenvironment variable, using theservice.nameattribute key. - The environment variable
DASH0_AUTOMATIC_SERVICE_NAME=falseis set.
With a configuration file, use the dash0_service_name resource detector instead (see Resource detection).
DASH0_BOOTSTRAP_SPAN
If set, the distribution creates a span immediately at startup, with the span name set to the value of DASH0_BOOTSTRAP_SPAN.
DASH0_DEBUG
Set DASH0_DEBUG=true to enable additional debug log output.
DASH0_DEBUG_PRINT_SPANS
If DASH0_DEBUG_PRINT_SPANS=true is set, all spans are printed to stdout via the ConsoleSpanExporter .
With a configuration file, add a span processor with a console exporter to the file instead.
DASH0_ENABLE_FS_INSTRUMENTATION
By default, the instrumentation @opentelemetry/instrumentation-fs is disabled.
Set DASH0_ENABLE_FS_INSTRUMENTATION=true to enable spans for file system access.
DASH0_FLUSH_ON_EMPTY_EVENT_LOOP
By default, the distribution installs a hook that shuts down the OpenTelemetry SDK gracefully when the Node.js runtime is about to exit because the event loop is empty.
This can be disabled by setting DASH0_FLUSH_ON_EMPTY_EVENT_LOOP=false.
The SDK shutdown is timeboxed to 500 milliseconds.
This hook can be helpful if you care about telemetry that is produced shortly before the process exits.
Disabling it can be useful if you care about the process terminating as quickly as possible when the event loop is empty.
Unlike the handlers for SIGTERM and SIGINT (see below), this hook does not re-raise a signal.
If the SDK shutdown completes within the timeout, the Node.js runtime exits on its own afterwards.
If it times out, the distribution calls process.exit().
Either way, the process exits with the exit code set in process.exitCode, if any.
DASH0_FLUSH_ON_SIGTERM_SIGINT
If DASH0_FLUSH_ON_SIGTERM_SIGINT=true is set, the distribution installs a handler for SIGTERM and SIGINT that shuts down the OpenTelemetry SDK gracefully when one of these signals is received.
The SDK shutdown is timeboxed to 500 milliseconds.
After the SDK shutdown has completed, or after the 500 millisecond timeout, whichever happens sooner, the signal handler re-raises the signal, so the process terminates with the signal's default behavior.
This option can be helpful if you care about telemetry that is produced shortly before the process terminates.
Do not use this option if the application has its own handler for SIGTERM or SIGINT, because the distribution's handler, and in particular re-raising the signal, might interfere with the application's own signal handler.
Standard OpenTelemetry environment variables
Without a configuration file, the OTEL_* environment variables that the upstream NodeSDK reads work as documented by the upstream project, for example:
OTEL_SERVICE_NAMEandOTEL_RESOURCE_ATTRIBUTESfor resource attributes.OTEL_EXPORTER_OTLP_HEADERSfor headers, such as an authorization header, sent with every export request.OTEL_TRACES_SAMPLERandOTEL_TRACES_SAMPLER_ARGfor sampling.OTEL_NODE_RESOURCE_DETECTORSto select resource detectors (see Resource detection).
The distribution also reads these variables itself:
| Variable | Default | Description |
|---|---|---|
OTEL_METRIC_EXPORT_INTERVAL | 60000 | Interval between metric exports, in milliseconds. |
OTEL_METRIC_EXPORT_TIMEOUT | 30000 | Timeout for a metric export, in milliseconds. |
OTEL_PROPAGATORS | tracecontext,baggage,xray | Context propagation formats. |
OTEL_NODE_ENABLED_INSTRUMENTATIONS | all | Enables only the listed instrumentations. |
With a configuration file, set interval and timeout on the periodic metric reader in the file instead of OTEL_METRIC_EXPORT_INTERVAL and OTEL_METRIC_EXPORT_TIMEOUT.
Context propagation
On Node.js 18.19.0 to 18.x and on 20.6.0 or newer, which use the OpenTelemetry JS SDK 2.x, the distribution uses tracecontext,baggage,xray if OTEL_PROPAGATORS is not set: W3C Trace Context, W3C Baggage and AWS X-Ray (X-Amzn-Trace-Id).
Outgoing requests carry both traceparent and X-Amzn-Trace-Id.
If an incoming request carries a valid X-Amzn-Trace-Id (with Root, Parent and Sampled), it takes precedence over traceparent.
An X-Amzn-Trace-Id without Parent, as added by an AWS load balancer to requests that arrive without one, is ignored, so the trace continues from traceparent.
Setting OTEL_PROPAGATORS replaces the default.
In addition to the values supported by the OpenTelemetry SDK (tracecontext, baggage, b3, b3multi, jaeger, none), the distribution supports xray, xray-lambda and ottrace via @opentelemetry/auto-configuration-propagators .
For example, set OTEL_PROPAGATORS=tracecontext,baggage to turn off X-Ray propagation.
On Node.js 16.x to 18.18.x and 20.0.0 to 20.5.x, which use the OpenTelemetry JS SDK 1.x, the distribution uses the SDK's default (tracecontext,baggage) and does not support xray.
With a configuration file, configure propagators in the file (see Declarative configuration).
Last updated: