From 6826f1be9c1fa2a4f46e1168d0e3313e2022d1d5 Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Thu, 11 Sep 2025 14:02:48 -0400 Subject: [PATCH 1/5] feat(otlp): Add docs for OTLP logs endpoint --- docs/concepts/otlp/index.mdx | 52 ++++++++++++++++++++++++++++++++-- src/components/codeContext.tsx | 7 +++++ 2 files changed, 56 insertions(+), 3 deletions(-) diff --git a/docs/concepts/otlp/index.mdx b/docs/concepts/otlp/index.mdx index ba5317bf7dd10..3c4a9e474db84 100644 --- a/docs/concepts/otlp/index.mdx +++ b/docs/concepts/otlp/index.mdx @@ -5,14 +5,17 @@ description: "Learn how to send OpenTelemetry trace data directly to Sentry from keywords: ["otlp", "otel", "opentelemetry"] --- +Sentry can ingest [OpenTelemetry](https://opentelemetry.io) traces and logs directly via the [OpenTelemetry Protocol](https://opentelemetry.io/docs/specs/otel/protocol/). Sentry does not support ingesting OTLP metrics. + +## OpenTelemetry Traces + -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: +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 are shown in the [Trace View](/concepts/key-terms/tracing/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](/concepts/key-terms/tracing/trace-view/). -- Sentry does not support ingesting OTLP metrics or OTLP logs. 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. @@ -39,7 +42,50 @@ const sdk = new NodeSDK({ sdk.start(); ``` -You can find the values of Sentry's OTLP endpoint and public key in your Sentry project settings. +You can find the values of Sentry's OTLP traces endpoint and public key in your Sentry project settings. + +1. Go to the [Settings > Projects](https://sentry.io/orgredirect/organizations/:orgslug/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. + +## OpenTelemetry Logs + + + +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. + +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. + +```bash {filename: .env} +export OTEL_EXPORTER_OTLP_LOGS_ENDPOINT="___OTLP_LOGS_URL___" +export OTEL_EXPORTER_OTLP_LOGS_HEADERS="x-sentry-auth=sentry sentry_key=___PUBLIC_KEY___" +``` + +Alternatively, you can configure the OpenTelemetry Exporter directly in your application code. Here is an example with the OpenTelemetry Node SDK: + +```typescript {filename: app.ts} +import { + LoggerProvider, + BatchLogRecordProcessor, +} from "@opentelemetry/sdk-logs"; +import { OTLPLogExporter } from "@opentelemetry/exporter-logs-otlp-http"; + +const logExporter = new OTLPLogExporter({ + url: "___OTLP_LOGS_URL___", + headers: { + "x-sentry-auth": "sentry sentry_key=___PUBLIC_KEY___", + }, +}); +const loggerProvider = new LoggerProvider({ + processors: [new BatchRecordProcessor(logExporter)], +}); + +const logger = loggerProvider.getLogger("default", "1.0.0"); +``` + +You can find the values of Sentry's OTLP logs endpoint and public key in your Sentry project settings. 1. Go to the [Settings > Projects](https://sentry.io/orgredirect/organizations/:orgslug/settings/projects/) page in Sentry. 2. Select a project from the list. diff --git a/src/components/codeContext.tsx b/src/components/codeContext.tsx index e70635a4eec1c..0ff390329487e 100644 --- a/src/components/codeContext.tsx +++ b/src/components/codeContext.tsx @@ -14,6 +14,7 @@ type ProjectCodeKeywords = { ORG_ID: number; ORG_INGEST_DOMAIN: string; ORG_SLUG: string; + OTLP_LOGS_URL: string; OTLP_TRACES_URL: string; PROJECT_ID: number; PROJECT_SLUG: string; @@ -88,6 +89,7 @@ export const DEFAULTS: CodeKeywords = { 'https://o0.ingest.sentry.io/api/0/minidump/?sentry_key=examplePublicKey', UNREAL_URL: 'https://o0.ingest.sentry.io/api/0/unreal/examplePublicKey/', OTLP_TRACES_URL: 'https://o0.ingest.sentry.io/api/0/otlp/v1/traces/', + OTLP_LOGS_URL: 'https://o0.ingest.sentry.io/api/0/otlp/v1/logs/', title: `example-org / example-project`, }, ], @@ -143,6 +145,10 @@ const formatOtlpTracesUrl = ({scheme, host, pathname}: Dsn) => { return `${scheme}${host}/api${pathname}/otlp/v1/traces/`; }; +const formatOtlpLogsUrl = ({scheme, host, pathname}: Dsn) => { + return `${scheme}${host}/api${pathname}/otlp/v1/logs/`; +}; + const formatApiUrl = ({scheme, host}: Dsn) => { const apiHost = host.indexOf('.ingest.') >= 0 ? host.split('.ingest.')[1] : host; @@ -236,6 +242,7 @@ export async function fetchCodeKeywords(): Promise { MINIDUMP_URL: formatMinidumpURL(parsedDsn), UNREAL_URL: formatUnrealEngineURL(parsedDsn), OTLP_TRACES_URL: formatOtlpTracesUrl(parsedDsn), + OTLP_LOGS_URL: formatOtlpLogsUrl(parsedDsn), title: `${project.organizationSlug} / ${project.projectSlug}`, }; }), From c1736bc32f927e7a0a397c67eaaa1ef09b49b189 Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Thu, 11 Sep 2025 14:13:26 -0400 Subject: [PATCH 2/5] add note about distributed tracing between sentry and otel --- docs/concepts/otlp/index.mdx | 164 +++++++++++++++++++++++++++++++++++ 1 file changed, 164 insertions(+) diff --git a/docs/concepts/otlp/index.mdx b/docs/concepts/otlp/index.mdx index 3c4a9e474db84..f4d4d836cc5f4 100644 --- a/docs/concepts/otlp/index.mdx +++ b/docs/concepts/otlp/index.mdx @@ -90,3 +90,167 @@ You can find the values of Sentry's OTLP logs endpoint and public key in your Se 1. Go to the [Settings > Projects](https://sentry.io/orgredirect/organizations/:orgslug/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. + +## Distributed Tracing between Sentry Instrumentation and OpenTelemetry Instrumentation + +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: + +### JavaScript + +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- From 844a601339371492844a82e027c86540e9f945e3 Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Thu, 25 Sep 2025 11:47:11 -0400 Subject: [PATCH 3/5] switch to integrations endpoint --- docs/concepts/otlp/index.mdx | 2 +- src/components/codeContext.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/concepts/otlp/index.mdx b/docs/concepts/otlp/index.mdx index f4d4d836cc5f4..c96a87aed3d15 100644 --- a/docs/concepts/otlp/index.mdx +++ b/docs/concepts/otlp/index.mdx @@ -50,7 +50,7 @@ You can find the values of Sentry's OTLP traces endpoint and public key in your ## OpenTelemetry Logs - + 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: diff --git a/src/components/codeContext.tsx b/src/components/codeContext.tsx index 0ff390329487e..ad678268bf939 100644 --- a/src/components/codeContext.tsx +++ b/src/components/codeContext.tsx @@ -89,7 +89,7 @@ export const DEFAULTS: CodeKeywords = { 'https://o0.ingest.sentry.io/api/0/minidump/?sentry_key=examplePublicKey', UNREAL_URL: 'https://o0.ingest.sentry.io/api/0/unreal/examplePublicKey/', OTLP_TRACES_URL: 'https://o0.ingest.sentry.io/api/0/otlp/v1/traces/', - OTLP_LOGS_URL: 'https://o0.ingest.sentry.io/api/0/otlp/v1/logs/', + OTLP_LOGS_URL: 'https://o0.ingest.sentry.io/api/0/integrations/otlp/v1/logs/', title: `example-org / example-project`, }, ], @@ -146,7 +146,7 @@ const formatOtlpTracesUrl = ({scheme, host, pathname}: Dsn) => { }; const formatOtlpLogsUrl = ({scheme, host, pathname}: Dsn) => { - return `${scheme}${host}/api${pathname}/otlp/v1/logs/`; + return `${scheme}${host}/api${pathname}/integrations/otlp/v1/logs/`; }; const formatApiUrl = ({scheme, host}: Dsn) => { From 38ff5979eb4b315cb7f33e48d105701d8d150bc4 Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Fri, 26 Sep 2025 10:45:21 -0400 Subject: [PATCH 4/5] feat: use feedback logging --- docs/concepts/otlp/index.mdx | 4 ++-- includes/feature-available-alpha-logs.mdx | 5 +++++ includes/feature-available-alpha-otlp.mdx | 5 ----- includes/feature-available-alpha-tracing.mdx | 5 +++++ includes/feature-stage-alpha-metrics.mdx | 6 ------ includes/feature-stage-beta-metrics.mdx | 6 ------ 6 files changed, 12 insertions(+), 19 deletions(-) create mode 100644 includes/feature-available-alpha-logs.mdx delete mode 100644 includes/feature-available-alpha-otlp.mdx create mode 100644 includes/feature-available-alpha-tracing.mdx delete mode 100644 includes/feature-stage-alpha-metrics.mdx delete mode 100644 includes/feature-stage-beta-metrics.mdx diff --git a/docs/concepts/otlp/index.mdx b/docs/concepts/otlp/index.mdx index c96a87aed3d15..0bf83deec0bac 100644 --- a/docs/concepts/otlp/index.mdx +++ b/docs/concepts/otlp/index.mdx @@ -9,7 +9,7 @@ Sentry can ingest [OpenTelemetry](https://opentelemetry.io) traces and logs dire ## OpenTelemetry Traces - + 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: @@ -50,7 +50,7 @@ You can find the values of Sentry's OTLP traces endpoint and public key in your ## OpenTelemetry Logs - + 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: diff --git a/includes/feature-available-alpha-logs.mdx b/includes/feature-available-alpha-logs.mdx new file mode 100644 index 0000000000000..58143fd56318c --- /dev/null +++ b/includes/feature-available-alpha-logs.mdx @@ -0,0 +1,5 @@ + + +This feature is in alpha and is only available if your organization is participating in its limited release. Please reach out to [feedback-logging@sentry.io](mailto:feedback-logging@sentry.io) if you want access. Features in alpha are still in-progress and may have bugs. We recognize the irony. + + diff --git a/includes/feature-available-alpha-otlp.mdx b/includes/feature-available-alpha-otlp.mdx deleted file mode 100644 index 815ed1fee85e0..0000000000000 --- a/includes/feature-available-alpha-otlp.mdx +++ /dev/null @@ -1,5 +0,0 @@ - - -This feature is in beta and is only available if your organization is participating in its limited release. Please reach out to [feedback-tracing@sentry.io](mailto:feedback-tracing@sentry.io) if you want access. Features in beta are still in-progress and may have bugs. We recognize the irony. - - diff --git a/includes/feature-available-alpha-tracing.mdx b/includes/feature-available-alpha-tracing.mdx new file mode 100644 index 0000000000000..9051b88dbd0cf --- /dev/null +++ b/includes/feature-available-alpha-tracing.mdx @@ -0,0 +1,5 @@ + + +This feature is in alpha and is only available if your organization is participating in its limited release. Please reach out to [feedback-tracing@sentry.io](mailto:feedback-tracing@sentry.io) if you want access. Features in alpha are still in-progress and may have bugs. We recognize the irony. + + diff --git a/includes/feature-stage-alpha-metrics.mdx b/includes/feature-stage-alpha-metrics.mdx deleted file mode 100644 index 67bebf0fd09ff..0000000000000 --- a/includes/feature-stage-alpha-metrics.mdx +++ /dev/null @@ -1,6 +0,0 @@ - - -Sentry Metrics is currently in Alpha, so be gentle - features are still in-progress and may have bugs. We recognize the irony. -If you would like to join the Alpha program, you can register [here](https://sentry.io/lp/metrics/). - - diff --git a/includes/feature-stage-beta-metrics.mdx b/includes/feature-stage-beta-metrics.mdx deleted file mode 100644 index 6e7b759e11cde..0000000000000 --- a/includes/feature-stage-beta-metrics.mdx +++ /dev/null @@ -1,6 +0,0 @@ - - -Sentry Metrics is currently in open beta, so be gentle - features are still in-progress and may have bugs. We recognize the irony. -For any questions or feedback, you can reach us on [Discord](https://discord.gg/sentry) or [GitHub](https://github.com/getsentry/sentry/discussions/64195). - - From 6737faf52f7ef3f114328f6627db683cd42a785d Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Fri, 26 Sep 2025 11:06:12 -0400 Subject: [PATCH 5/5] Update docs/concepts/otlp/index.mdx --- docs/concepts/otlp/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/concepts/otlp/index.mdx b/docs/concepts/otlp/index.mdx index 0bf83deec0bac..10ae84876812d 100644 --- a/docs/concepts/otlp/index.mdx +++ b/docs/concepts/otlp/index.mdx @@ -79,7 +79,7 @@ const logExporter = new OTLPLogExporter({ }, }); const loggerProvider = new LoggerProvider({ - processors: [new BatchRecordProcessor(logExporter)], + processors: [new BatchLogRecordProcessor(logExporter)], }); const logger = loggerProvider.getLogger("default", "1.0.0");