|
| 1 | +--- |
| 2 | +title: OpenTelemetry Protocol (OTLP) |
| 3 | +sidebar_order: 400 |
| 4 | +description: "Learn how to send OpenTelemetry trace data directly to Sentry from OpenTelemetry SDKs." |
| 5 | +keywords: ["otlp", "otel", "opentelemetry"] |
| 6 | +--- |
| 7 | + |
| 8 | +<Include name="feature-available-for-user-group-limited-avail.mdx" /> |
| 9 | + |
| 10 | +Sentry can ingest [OpenTelemetry](https://opentelemetry.io) traces directly via the [OpenTelemetry Protocol](https://opentelemetry.io/docs/specs/otel/protocol/). If you have an existing OpenTelemetry trace instrumentation, you can configure your OpenTelemetry exporter to send traces to Sentry directly. Sentry's OTLP ingestion endpoint is currently in development, and has a few known limitations: |
| 11 | + |
| 12 | +- Span events are not supported. All span events are dropped during ingestion. |
| 13 | +- Span links are partially supported. We ingest and display span links, but they cannot be searched, filtered, or aggregated. Links are are shown in the [Trace View](https://docs.sentry.io/concepts/key-terms/tracing/trace-view/). |
| 14 | +- Array attributes are partially supported. We ingest and display array attributes, but they cannot be searched, filtered, or aggregated. Array attributes are shown in the [Trace View](https://docs.sentry.io/concepts/key-terms/tracing/trace-view/). |
| 15 | +- Sentry does not support ingesting OTLP metrics or OTLP logs. |
| 16 | + |
| 17 | +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. Set these variables on the server where your application is running. |
| 18 | + |
| 19 | +```bash {filename: .env} |
| 20 | +export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT="___OTLP_TRACES_URL___"" |
| 21 | +export OTEL_EXPORTER_OTLP_TRACES_HEADERS="x-sentry-auth=sentry sentry_key=___PUBLIC_KEY___" |
| 22 | +``` |
| 23 | +
|
| 24 | +Alternatively, you can configure the OpenTelemetry Exporter directly in your application code. Here is an example with the OpenTelemetry Node SDK: |
| 25 | +
|
| 26 | +```typescript {filename: app.ts} |
| 27 | +import { NodeSDK } from "@opentelemetry/sdk-node"; |
| 28 | +import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http"; |
| 29 | +
|
| 30 | +const sdk = new NodeSDK({ |
| 31 | + traceExporter: new OTLPTraceExporter({ |
| 32 | + url: "___OTLP_TRACES_URL___", |
| 33 | + headers: { |
| 34 | + "x-sentry-auth": "sentry sentry_key=___PUBLIC_KEY___", |
| 35 | + }, |
| 36 | + }), |
| 37 | +}); |
| 38 | +
|
| 39 | +sdk.start(); |
| 40 | +``` |
| 41 | +
|
| 42 | +<Alert> |
| 43 | +If you are already using an OpenTelemetry SDK to send traces alongside a Sentry SDK to send errors, you'll need to follow the instructions in the <PlatformLink to="/opentelemetry/custom-setup/">Custom Setup documentation</PlatformLink> to adjust your SDK configuration. |
| 44 | +</Alert> |
| 45 | +
|
| 46 | +You can find the values of Sentry's OTLP endpoint and public key in your Sentry project settings. |
| 47 | +
|
| 48 | +1. Go to the [Settings > Projects](https://sentry.io/orgredirect/organizations/:orgslug/settings/projects/) page in Sentry. |
| 49 | +2. Select a project from the list. |
| 50 | +3. Go to the "Client Keys (DSN)" sub-page for this project under the "SDK Setup" heading. |
0 commit comments