OpenTelemetry Protocol (OTLP)
Learn how to send OpenTelemetry trace data directly to Sentry from OpenTelemetry SDKs.
Sentry can ingest OpenTelemetry traces and logs directly via the OpenTelemetry Protocol. Sentry does not support ingesting OTLP metrics.
This feature is currently in open beta. Please reach out to feedback-tracing@sentry.io if you have feedback or questions. Features in beta are still in-progress and may have bugs. We recognize the irony.
If you have an existing OpenTelemetry trace instrumentation, you can configure your OpenTelemetry exporter to send traces to Sentry directly. Sentry's OTLP ingestion traces endpoint is currently in development, and has a few known limitations:
- Span events are not supported. All span events are dropped during ingestion.
- Span links are partially supported. We ingest and display span links, but they cannot be searched, filtered, or aggregated. Links are shown in the Trace View.
- 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.
You can find the values of Sentry's OTLP traces endpoint and public key in your Sentry project settings.
- Go to the Settings > Projects page in Sentry.
- Select a project from the list.
- Go to the "Client Keys (DSN)" sub-page for this project under the "SDK Setup" heading.
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.
.envexport OTEL_EXPORTER_OTLP_TRACES_ENDPOINT="https://o0.ingest.sentry.io/api/0/integration/otlp/v1/traces"
export OTEL_EXPORTER_OTLP_TRACES_HEADERS="x-sentry-auth=sentry sentry_key=examplePublicKey"
If you prefer to explicitly configure an OpenTelemetry SDK or OTEL collector instance, see the following:
You can configure your OTEL collector instance to send traces to Sentry directly. This requires you to add an otlphttp exporter to your collector instance. Sentry's OTLP endpoints are project-specific, so you might also need to add a routing connector to route traces to the correct project.
otel-collector.yamlexporters:
otlphttp:
traces_endpoint: https://o0.ingest.sentry.io/api/0/integration/otlp/v1/traces
headers:
x-sentry-auth: "sentry sentry_key=examplePublicKey"
compression: gzip
encoding: proto
timeout: 30s
You can configure the OpenTelemetry Exporter directly in your application code. Here is an example with the OpenTelemetry Node SDK:
app.tsimport { 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/integration/otlp/v1/traces",
headers: {
"x-sentry-auth": "sentry sentry_key=examplePublicKey",
},
}),
});
sdk.start();
This feature is currently in open beta. Please reach out to feedback-logging@sentry.io if you have feedback or questions. Features in beta are still in-progress and may have bugs. We recognize the irony.
If you have an existing OpenTelemetry log instrumentation, you can configure your OpenTelemetry exporter to send logs to Sentry directly. Sentry's OTLP ingestion logs endpoint has the following known limitations:
- Array attributes are partially supported. We ingest and display array attributes, but they cannot be searched, filtered, or aggregated.
You can find the values of Sentry's OTLP logs endpoint and public key in your Sentry project settings.
- Go to the Settings > Projects page in Sentry.
- Select a project from the list.
- Go to the "Client Keys (DSN)" sub-page for this project under the "SDK Setup" heading.
The easiest way to configure an OpenTelemetry exporter is with environment variables. You'll need to configure the logs endpoint URL, as well as the authentication headers. Set these variables on the server where your application is running.
.envexport OTEL_EXPORTER_OTLP_LOGS_ENDPOINT="https://o0.ingest.sentry.io/api/0/integration/otlp/v1/logs"
export OTEL_EXPORTER_OTLP_LOGS_HEADERS="x-sentry-auth=sentry sentry_key=examplePublicKey"
If you prefer to explicitly configure an OpenTelemetry SDK or OTEL collector instance, see the following:
You can configure your OTEL collector instance to send logs to Sentry directly. This requires you to add an otlphttp exporter to your collector instance. Sentry's OTLP endpoints are project-specific, so you might also need to add a routing connector to route logs to the correct project.
otel-collector.yamlexporters:
otlphttp:
logs_endpoint: https://o0.ingest.sentry.io/api/0/integration/otlp/v1/logs
headers:
x-sentry-auth: "sentry sentry_key=examplePublicKey"
compression: gzip
encoding: proto
timeout: 30s
Alternatively, you can configure the OpenTelemetry Exporter directly in your application code. Here is an example with the OpenTelemetry Node SDK:
app.tsimport {
LoggerProvider,
BatchLogRecordProcessor,
} from "@opentelemetry/sdk-logs";
import { OTLPLogExporter } from "@opentelemetry/exporter-logs-otlp-http";
const logExporter = new OTLPLogExporter({
url: "https://o0.ingest.sentry.io/api/0/integration/otlp/v1/logs",
headers: {
"x-sentry-auth": "sentry sentry_key=examplePublicKey",
},
});
const loggerProvider = new LoggerProvider({
processors: [new BatchLogRecordProcessor(logExporter)],
});
const logger = loggerProvider.getLogger("default", "1.0.0");
If you have a frontend or services instrumented with the Sentry SDK, and you are also instrumenting with OpenTelemetry, you can use the propagateTraceparent exposed in the Sentry SDK to propagate the W3C Trace Context traceparent header to the OpenTelemetry instrumentation. This will allow you to continue traces from Sentry instrumented services.
The following SDKs support the propagateTraceparent option:
Browser JavaScript
Angular
Astro
Ember
Gatsby
Next.js
Nuxt
React
React Router
Remix
Solid
SolidStart
Svelte
SvelteKit
Vue
Wasm
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").