Configuration
Note: This page is auto-generated from the opentelemetry-java-distribution repository.
Every OTEL_* variable and -Dotel.* system property works as it does with the upstream agent, which upstream's configuration reference documents.
Dash0 environment variables
| Variable | Effect |
|---|---|
DASH0_OTEL_COLLECTOR_BASE_URL | Sets the OTLP endpoint, unless OTEL_EXPORTER_OTLP_ENDPOINT is set. |
DASH0_DISABLE | Set to true to stop all recording and export. |
DASH0_AUTOMATIC_SERVICE_NAME, DASH0_BOOTSTRAP_SPAN and DASH0_FLUSH_ON_SIGTERM_SIGINT from the Node.js and Python distributions are not supported.
The agent already names the service, as resource detection describes, and flushes on shutdown.
DASH0_OTEL_COLLECTOR_BASE_URL
Set it to the base URL of your collector or of the Dash0 ingress, such as http://localhost:4318.
The agent appends /v1/traces, /v1/metrics and /v1/logs itself, and 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.
To send one signal to a different place, set OTEL_EXPORTER_OTLP_TRACES_ENDPOINT or one of its siblings, which also override it.
DASH0_DISABLE
Set DASH0_DISABLE=true to turn the SDK into a no-op.
The agent still attaches, but nothing is recorded or exported.
It overrides OTEL_SDK_DISABLED=false.
Only the value true counts, in any case and with surrounding spaces ignored.
To stop the agent from attaching at all, set OTEL_JAVAAGENT_ENABLED=false instead.
Changed defaults
OTEL_TRACES_SAMPLERisalways_on. Upstream usesparentbased_always_on.OTEL_PROPAGATORSistracecontext,baggage,xray. Upstream usestracecontext,baggage.OTEL_SEMCONV_STABILITY_OPT_INisdatabase,code,rpc,messaging. Upstream leaves it unset.
Each one is a default.
Setting the variable or the matching -Dotel.* system property on the workload replaces it.
OTEL_TRACES_SAMPLER
The distribution records every span the application starts.
Under the upstream default, a request that arrives with a traceparent header whose sampled flag is off is not recorded, in your service or in any service it calls.
The caller that sets that flag is often outside your control.
Dash0 samples whole traces after ingestion, with SignalControl, and a sampler in your process drops spans before they get there.
The volume recorded can be reduced with SignalControl or with a sampling processor in your collector. To sample in the process anyway:
export OTEL_TRACES_SAMPLER=parentbased_traceidratio
export OTEL_TRACES_SAMPLER_ARG=0.1OTEL_PROPAGATORS
Outgoing requests carry an AWS X-Amzn-Trace-Id header as well as the W3C traceparent header.
This keeps one trace across an AWS Application Load Balancer, which reads and writes X-Amzn-Trace-Id.
When an incoming request carries both headers, the X-Amzn-Trace-Id context overrides.
That can attach your span to the wrong parent when a proxy in front of you writes a new traceparent but forwards an older X-Amzn-Trace-Id unchanged.
AWS services with X-Ray active tracing, such as API Gateway, can cause the same thing.
If you see spans parented to the wrong service, go back to traceparent alone:
export OTEL_PROPAGATORS=tracecontext,baggageOTEL_SEMCONV_STABILITY_OPT_IN
The agent emits the current semantic conventions for databases, code, RPC and messaging, instead of the older ones the upstream agent still emits by default. HTTP already uses the current conventions in every configuration.
If you have dashboards, queries or alerts built on the upstream agent's output, check them before you switch. These change:
- Database span attributes.
db.statement,db.system,db.nameanddb.operationbecomedb.query.text,db.system.name,db.namespaceanddb.query.summaryordb.operation.name.db.user,db.connection_stringanddb.sql.tableare no longer emitted. - Span names for database, RPC and messaging spans.
A Kafka producer span named
orders publishbecomessend orders, and a Redis span namedGETbecomesGET redis.example:6379. - Messaging span kinds.
Receive spans change from
CONSUMERtoCLIENT. - Connection pool metrics.
db.client.connections.*becomesdb.client.connection.*, andcreate_time,wait_timeanduse_timechange from milliseconds to seconds. An alert threshold written in milliseconds will not fire after the switch. - New metrics, such as
db.client.operation.durationandmessaging.client.operation.duration.
To keep the older conventions everywhere, set the variable to none:
export OTEL_SEMCONV_STABILITY_OPT_IN=noneAn empty value does not work, because it counts as unset.
Setting it in the file that otel.javaagent.configuration-file names does not work either, because the agent does not read this setting from that file.
During a migration you can emit both sets by appending /dup to a domain, as in database/dup,code,rpc,messaging.
This doubles the attributes on every affected span.
Connection pool metrics are renamed even with /dup.
Capturing MDC entries on log records
The agent does not copy MDC entries onto log records by default. Turn capture on for each logging framework you use, with the variable for that framework.
- Logback uses
OTEL_INSTRUMENTATION_LOGBACK_APPENDER_EXPERIMENTAL_MDC_ATTRIBUTES_EXCLUDED. - Log4j 1.2, and Log4j 2.17 and later, use
OTEL_INSTRUMENTATION_LOG4J_APPENDER_EXPERIMENTAL_MDC_ATTRIBUTES_EXCLUDED. - JBoss Log Manager, as used by WildFly and JBoss EAP, uses
OTEL_INSTRUMENTATION_JBOSS_LOGMANAGER_EXPERIMENTAL_MDC_ATTRIBUTES_EXCLUDED.
The JBoss name has no _APPENDER_ in it.
A variable with _APPENDER_ there is ignored without a warning.
Each variable takes a comma-separated list of glob patterns, and every MDC key that matches none of them is captured. This list keeps the most common credential names out:
export OTEL_INSTRUMENTATION_LOGBACK_APPENDER_EXPERIMENTAL_MDC_ATTRIBUTES_EXCLUDED='*token*,*Token*,*TOKEN*,*secret*,*Secret*,*SECRET*,*password*,*Password*,*PASSWORD*,*authorization*,*Authorization*,*AUTHORIZATION*'Matching is case-sensitive, so each word appears in three spellings.
The list does not catch keys such as jwt, apiKey, sessionId or Cookie, and it never looks at values.
Extend it for your application, or name only the keys you want with the matching _MDC_ATTRIBUTES_INCLUDED variable:
export OTEL_INSTRUMENTATION_LOGBACK_APPENDER_EXPERIMENTAL_MDC_ATTRIBUTES_INCLUDED='request.id,tenant.id,user.*'A log record keeps at most 128 attributes, set by OTEL_ATTRIBUTE_COUNT_LIMIT, and drops the rest without a warning.
On Log4j 2.17 and later the MDC entries are added first, so a large MDC can push out exception.type, exception.message and exception.stacktrace.
The older variables ending in _EXPERIMENTAL_CAPTURE_MDC_ATTRIBUTES take a list of keys, not true.
Setting one to true captures only a key named true.
They are ignored when an _INCLUDED or _EXCLUDED variable is set.
Upstream marks all of these variables as experimental, and may rename them in a later agent version.
Declarative configuration
A declarative configuration file is a YAML file that replaces configuration from environment variables. The distribution uses the first of these that applies:
- The file
OTEL_CONFIG_FILEnames, when it is set and not blank. /etc/opentelemetry/java/otel-config.yaml, when that file exists. The Dash0 Linux packages install it.- No file, so the SDK is configured from the environment as described above.
OTEL_SDK_DISABLED=true keeps the file in step 2 from loading.
To move a whole host back to step 3, remove or rename the file in step 2.
To move one workload to a different file, set OTEL_CONFIG_FILE.
If OTEL_CONFIG_FILE names a file that does not exist, the SDK reports an error and exports nothing.
It does not fall back to step 2.
A file that cannot be parsed, or that names an exporter, sampler or detector the agent does not know, stops the agent with OpenTelemetry Javaagent failed to start in the log.
The application keeps running without instrumentation, and the JVM still exits with status zero.
Check a file against the agent version before you roll it out to a host.
What the distribution adds to a file
| Setting | Effect under a file |
|---|---|
DASH0_DISABLE=true | Disables the SDK. |
DASH0_OTEL_COLLECTOR_BASE_URL | Fills in the endpoint of each OTLP exporter the file declares without one, or with the OTLP default such as http://localhost:4318/v1/traces. |
| The sampler default | Sets always_on unless the file declares a sampler. |
| The propagators default | Sets tracecontext,baggage,xray unless the file declares propagators. |
| The Dash0 resource attributes | Added to resource.attributes unless the file sets the same names. |
The host, process and service detectors | Added unless the file names them. |
DASH0_OTEL_COLLECTOR_BASE_URL never adds an exporter.
To have it set the endpoint, declare the exporter in the file and leave endpoint out:
file_format: "1.0"
tracer_provider:
processors:
- batch:
exporter:
otlp_http: {}When OTEL_EXPORTER_OTLP_ENDPOINT is set, the distribution leaves every endpoint as the file wrote it.
The SDK does not read OTEL_EXPORTER_OTLP_ENDPOINT under a file, so it only takes effect if the file uses it, as in ${OTEL_EXPORTER_OTLP_ENDPOINT}/v1/traces.
What a file does not read
Under a file the SDK ignores most OTEL_* variables.
A variable still applies when the file refers to it with ${VARIABLE} syntax.
The file the Dash0 Linux packages install refers to OTEL_EXPORTER_OTLP_ENDPOINT and OTEL_RESOURCE_ATTRIBUTES.
OTEL_SERVICE_NAME still applies through the service detector, unless the file sets service.name itself.
These have no effect under a file:
-
The
OTEL_RESOURCE_PROVIDERS_*_ENABLEDtoggles andOTEL_JAVA_DISABLED_RESOURCE_PROVIDERS. Name detectors underresource.detection/developmentin the file instead. -
The MDC variables. Set the same lists in the file:
instrumentation/development: java: logback_appender: mdc_attributes/development: excluded: ["*token*", "*Token*", "*TOKEN*"]Use
log4j_appenderorjboss_logmanagerin place oflogback_appenderfor the other frameworks. -
The
OTEL_SEMCONV_STABILITY_OPT_INdefault. The variable itself still works if you set it.
Removing detected attributes
To drop attributes the detectors add, filter them by name in the file:
resource:
detection/development:
attributes:
excluded:
- host.*
- process.*The filter applies to detected attributes only, so the Dash0 attributes and anything in resource.attributes are kept.
Last updated: