OTLP

Learn how to send OpenTelemetry trace data directly to Sentry from OpenTelemetry SDKs.

Sentry can ingest OpenTelemetry traces directly via the OpenTelemetry Protocol. If you have existing OpenTelemetry trace instrumentation, you can configure your OpenTelemetry exporter to send traces to Sentry directly.

The easiest way to configure an OpenTelemetry Exporter is with environment variables. You'll need to configure the trace endpoint URL, as well as the authentication headers.

.env
Copied
export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT="https://o0.ingest.sentry.io/api/0/otlp/v1/traces""
export OTEL_EXPORTER_OTLP_TRACES_HEADERS="x-sentry-auth=sentry sentry_key=examplePublicKey"

If you don't want to use environment variables, you can configure the OpenTelemetry Exporter directly in your application code.

app.ts
Copied
import { NodeSDK } from "@opentelemetry/sdk-node";
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";

const sdk = new NodeSDK({
  traceExporter: new OTLPTraceExporter({
    url: "https://o0.ingest.sentry.io/api/0/otlp/v1/traces",
    headers: {
      "x-sentry-auth": "sentry sentry_key=examplePublicKey",
    },
  }),
});

sdk.start();

You can find the values of Sentry's OTLP endpoint and public key in your Sentry project settings.

  1. Go to the Settings > Projects page in Sentry.
  2. Select a project from the list.
  3. Go to the "Client Keys (DSN)" sub-page for this project under the "SDK Setup" heading.
Was this helpful?
Help improve this content
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").