---
title: "OpenTelemetry Agentless"
description: "Using OpenTelemetry with  sentry-opentelemetry-agentless."
url: https://docs.sentry.io/platforms/java/guides/servlet/opentelemetry/setup/agentless/
---

# OpenTelemetry Agentless | Sentry for Servlet

If you do not want to use our recommended [Java Agent](https://docs.sentry.io/platforms/java/guides/servlet/opentelemetry/setup/agent.md), we also offer a dependency that allows you to use OpenTelemetry with Sentry.

## [Install](https://docs.sentry.io/platforms/java/guides/servlet/opentelemetry/setup/agentless.md#install)

In addition to your typical Sentry dependencies, you will need to add `sentry-opentelemetry-agentless` as a dependency:

```groovy
implementation 'io.sentry:sentry-opentelemetry-agentless:8.37.1'
```

Please note, if you're using Spring Boot, there's a separate `sentry-opentelemetry-agentless-spring` dependency. You can [find out more here](https://docs.sentry.io/platforms/java/guides/spring-boot/opentelemetry/setup/agentless.md).

## [Usage](https://docs.sentry.io/platforms/java/guides/servlet/opentelemetry/setup/agentless.md#usage)

You'll have to configure both OpenTelemetry and Sentry to see transactions in Sentry and have errors linked to transactions created by OpenTelemetry.

#### [Initializing OpenTelemetry](https://docs.sentry.io/platforms/java/guides/servlet/opentelemetry/setup/agentless.md#initializing-opentelemetry)

Our `sentry-opentelemetry-agentless` dependency also adds `opentelemetry-sdk-extension-autoconfigure` which takes care of configuring OpenTelemetry to work with Sentry. You can configure it using `AutoConfiguredOpenTelemetrySdk`:

```java
import io.opentelemetry.sdk.autoconfigure.AutoConfiguredOpenTelemetrySdk;

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();
```

#### [Initializing Sentry](https://docs.sentry.io/platforms/java/guides/servlet/opentelemetry/setup/agentless.md#initializing-sentry)

You can initialize Sentry as usual, fore example, by calling `Sentry.init`:

```java
import io.sentry.Sentry;

Sentry.init(options -> {
  options.setDsn("___PUBLIC_DSN___");
  options.setTracesSampleRate(1.0);
});
```
