OpenTelemetry Agent Without Auto Init
Using OpenTelemetry with sentry-opentelemetry-agent and AUTO_INIT disabled.
You may also disable automatic initialization of Sentry in sentry-opentelemetry-agent
by setting SENTRY_AUTO_INIT=false
as an environment variable. Doing this will mean you'll either have to use another Sentry integration that performs initialization, (for example Spring Boot), or initialize Sentry manually.
For Spring Boot we recommend disabling the Agents AUTO_INIT
and instead letting our Spring Boot integration take care of initializing the SDK as this allows for a more convenient configuration of Sentry using application.properties
/application.yml
and Spring beans.
You can download the latest version of the sentry-opentelemetry-agent-8.9.0.jar
from MavenCentral. It's also available as a ZIP
containing the JAR
used on this page on GitHub.
This java
command shows how to run your application using sentry-opentelemetry-agent
:
SENTRY_AUTO_INIT=false JAVA_TOOL_OPTIONS="-javaagent:sentry-opentelemetry-agent-8.9.0.jar" java -jar your-application.jar
The Spring Boot Sentry SDK will take care of initializing Sentry, just make sure a tracesSampleRate
has been set:
sentry.dsn=https://examplePublicKey@o0.ingest.sentry.io/0
sentry.traces-sample-rate=1.0
To enable debug logging for Sentry, set SENTRY_DEBUG=true
as an environment variable or add sentry.debug=true
to your application.properties
.
To show debug output for OpenTelemetry, add -Dotel.javaagent.debug=true
to the java
command.
If you're not using any OpenTelemetry exporters besides Sentry, add the following environment variables to turn off exporters and stop receiving error messages about servers not being reachable in the logs.
Example log message:
ERROR io.opentelemetry.exporter.internal.grpc.OkHttpGrpcExporter - Failed to export spans. The request could not be executed. Full error message: Failed to connect to localhost/[0:0:0:0:0:0:0:1]:4317
ERROR io.opentelemetry.exporter.internal.grpc.OkHttpGrpcExporter - Failed to export metrics. The request could not be executed. Full error message: Failed to connect to localhost/[0:0:0:0:0:0:0:1]:4317
ERROR io.opentelemetry.exporter.internal.http.HttpExporter - Failed to export logs. The request could not be executed. Full error message: Failed to connect to localhost/[0:0:0:0:0:0:0:1]:4318
To turn off traces exporting, set OTEL_TRACES_EXPORTER=none
as an environment variable per OpenTelemetry GitHub.
To turn off metrics exporting, set OTEL_METRICS_EXPORTER=none
as an environment variable per OpenTelemetry GitHub.
To turn off log exporting, set OTEL_LOGS_EXPORTER=none
as an environment variable per OpenTelemetry GitHub.
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").