More information on OpenTelemetry can be found on their website as well as their docs and GitHub repos:
- https://opentelemetry.io/docs/instrumentation/java/getting-started/
- https://github.com/open-telemetry/opentelemetry-java
- https://github.com/open-telemetry/opentelemetry-java-instrumentation
Produces the Sentry OpenTelemetry Java Agent JAR
that can be used to auto instrument an
application. Please see the module README for more details on how to use it.
This contains customizations to the OpenTelemetry Java Agent such as registering the
SentrySpanProcessor
and SentryPropagator
as well as providing default properties that
enable the sentry
propagator.
Classes that are loaded into the bootstrap classloader
(represented as null
when invoking X.class.classLoader)
These are shared between the agent and the application and include things like storage,
utils, factory, tokens etc.
If you want to use Sentry with OpenTelemetry without the agent, you also need this module as a dependency.
Contains SentrySpanProcessor
and SentryPropagator
which are used by our Java Agent but can also
be used when manually instrumenting using OpenTelemetry. If you want to use OpenTelemetry without
the agent but still want some configuration convenience, you should rather use the
sentry-opentelemetry-agentless
module or the sentry-opentelemetry-agentless-spring
module if you are using Spring Boot.
Combines all modules and dependencies needed to use Sentry with OpenTelemetry without the agent.
Combines all modules and dependencies needed to use Sentry with OpenTelemetry in Spring Boot without an agent.
If you want to use Sentry with OpenTelemetry without an agent, you can do so by adding the sentry-opentelemetry-agentless
(or sentry-opentelemetry-agentless-spring
) module as dependency to your project.
And run your application with the following JVM arguments:
-Dotel.java.global-autoconfigure.enabled=true
You may also want to set the following environment variables to if you do not use OpenTelemetry exporters:
OTEL_LOGS_EXPORTER=none;OTEL_METRICS_EXPORTER=none;OTEL_TRACES_EXPORTER=none
Alternatively you can initialize OpenTelemetry programmatically like this:
// Initialize OpenTelemetry by using the AutoConfiguredOpenTelemetrySdk which automatically
// registers the `SentrySpanProcessor` and `SentryPropagator` and others.
// Also, you need to disable the OTEL exporters if you do not use them.
AutoConfiguredOpenTelemetrySdk.builder()
.setResultAsGlobal()
.addPropertiesSupplier(() -> {
final Map<String, String> properties = new HashMap<>();
properties.put("otel.logs.exporter", "none");
properties.put("otel.metrics.exporter", "none");
properties.put("otel.traces.exporter", "none");
return properties;
})
.build();
And then initialize Sentry as usual:
// Initialize Sentry
Sentry.init(
options -> {
options.setDsn("...");
...
}
)