Getting Started
Note: This page is auto-generated from the opentelemetry-java-distribution repository.
Download the agent
Download the agent jar and the SHA256SUMS file from the releases page , and check the jar against it:
VERSION=0.3.0
BASE=https://github.com/dash0hq/opentelemetry-java-distribution/releases/download/v${VERSION}
curl -fsSLO "${BASE}/dash0-opentelemetry-javaagent-${VERSION}.jar"
curl -fsSLO "${BASE}/SHA256SUMS"
sha256sum --check --ignore-missing SHA256SUMSOn macOS, use shasum -a 256 --check --ignore-missing SHA256SUMS instead of sha256sum.
Attach it to your application
Point the agent at an OpenTelemetry collector and start the JVM with -javaagent.
The commands on this page reuse VERSION from the download step:
export DASH0_OTEL_COLLECTOR_BASE_URL=http://localhost:4318
export OTEL_SERVICE_NAME=my-service
java -javaagent:dash0-opentelemetry-javaagent-${VERSION}.jar -jar my-application.jarThat is enough to instrument every supported library in the application and export traces, metrics and logs over OTLP/HTTP. The application needs no OpenTelemetry code and no rebuild.
When you cannot change the command line, put the flag in JAVA_TOOL_OPTIONS, which every JVM reads at startup.
Use the absolute path of the jar, because a relative path is resolved from each process's working directory:
export JAVA_TOOL_OPTIONS="-javaagent:$(pwd)/dash0-opentelemetry-javaagent-${VERSION}.jar"Every standard OTEL_* variable and -Dotel.* system property works as it does with the upstream agent.
A few of their defaults differ; see overview.
Send directly to Dash0
To export directly to Dash0 instead of a local collector, use your organization's OTLP endpoint and an auth token.
export DASH0_OTEL_COLLECTOR_BASE_URL=https://ingress.<region>.<cloud>.dash0.com
export OTEL_EXPORTER_OTLP_HEADERS="Authorization=Bearer ${DASH0_AUTH_TOKEN},Dash0-Dataset=default"
java -javaagent:dash0-opentelemetry-javaagent-${VERSION}.jar -jar my-application.jarUse the extension on the stock upstream agent instead
If you would rather keep the unmodified upstream agent, download dash0-opentelemetry-agentextension-<version>.jar from the same release and load it as an extension:
java -javaagent:opentelemetry-javaagent.jar \
-Dotel.javaagent.extensions=dash0-opentelemetry-agentextension-${VERSION}.jar \
-jar my-application.jarUse the upstream agent version the release is built on, which auto-instrumentation names. The extension changes the same defaults and adds the same attributes as the repackaged agent.
Check that it is active
Export metrics to the console and look at the resource attributes:
java -javaagent:dash0-opentelemetry-javaagent-${VERSION}.jar \
-Dotel.traces.exporter=none -Dotel.logs.exporter=none \
-Dotel.metrics.exporter=logging -Dotel.metric.export.interval=1000 \
-Dotel.service.name=my-service \
-jar my-application.jartelemetry.distro.name="dash0-java" in the printed resource means the distribution is in effect.
If it reads opentelemetry-java-instrumentation, the upstream agent is running without the Dash0 code, for example because the extension jar was not found.
Turn it off
Set DASH0_DISABLE=true to stop all recording and export without removing the agent.
Set OTEL_JAVAAGENT_ENABLED=false to stop the agent from attaching at all.
Supported JVMs
Java 8 and later, the same as the upstream agent. Upstream runs its integration tests on OpenJDK and OpenJ9 versions 8, 11, 17, 21, 25 and 27.
Last updated: