From eddce33606105bbdf6fdde0782ac82ba5452c764 Mon Sep 17 00:00:00 2001 From: "sentry-junior[bot]" <264270552+sentry-junior[bot]@users.noreply.github.com> Date: Wed, 21 Oct 2026 16:06:35 +0000 Subject: [PATCH 1/4] docs(js): Add OpenTelemetry JS v3 example to custom OpenTelemetry setup Co-Authored-By: Andrei Borza --- .../common/opentelemetry/custom-setup.mdx | 40 +++++++++++++++++-- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/docs/platforms/javascript/common/opentelemetry/custom-setup.mdx b/docs/platforms/javascript/common/opentelemetry/custom-setup.mdx index 8db80b6f05338..604f5be434418 100644 --- a/docs/platforms/javascript/common/opentelemetry/custom-setup.mdx +++ b/docs/platforms/javascript/common/opentelemetry/custom-setup.mdx @@ -16,9 +16,43 @@ Initialize your OpenTelemetry provider before calling `Sentry.init()`. Add an OTLP exporter to your existing provider. Install `@opentelemetry/exporter-trace-otlp-http` if you do not already use it. `Sentry.getOtlpTracesEndpoint()` supplies the endpoint URL and authentication headers for your DSN. -This example uses `NodeTracerProvider`. Add the same span processor to `spanProcessors` if you use `NodeSDK` instead. Keep your existing sampler, propagator, context manager, and instrumentation; do not register a second provider. +Pick the example that matches your OpenTelemetry JS version. Keep your existing sampler, propagator, context manager, and instrumentation; do not register a second provider. -```javascript {filename: instrument.mjs} +- **OpenTelemetry JS v3** (`@opentelemetry/sdk-node` 0.300 or later) replaces `@opentelemetry/sdk-trace-base` and `@opentelemetry/sdk-trace-node` with `@opentelemetry/sdk-trace`, and `BatchSpanProcessor` takes an options object with an `exporter` field. It requires Node.js 22.15 or later. The example uses `NodeSDK`, since v3 no longer ships `NodeTracerProvider`. +- **OpenTelemetry JS v2** works with `NodeTracerProvider` or `NodeSDK`. If you use `NodeSDK`, add the same span processor to its `spanProcessors` option. + +```javascript {tabTitle:OpenTelemetry JS v3} {filename: instrument.mjs} +import * as Sentry from "___SDK_PACKAGE___"; +import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http"; +import { NodeSDK } from "@opentelemetry/sdk-node"; +import { BatchSpanProcessor } from "@opentelemetry/sdk-trace"; + +const dsn = "___PUBLIC_DSN___"; +const endpoint = Sentry.getOtlpTracesEndpoint(dsn); + +if (!endpoint) { + throw new Error("Could not parse the Sentry DSN"); +} + +const sdk = new NodeSDK({ + spanProcessors: [ + new BatchSpanProcessor({ exporter: new OTLPTraceExporter(endpoint) }), + // Keep any other span processors you already use. + ], + // Keep your existing instrumentations, sampler, and propagator. +}); + +sdk.start(); + +Sentry.init({ + dsn, + enableOpenTelemetrySetup: false, + // Leave tracesSampleRate and tracesSampler unset. OpenTelemetry owns tracing. + integrations: [Sentry.openTelemetryIntegration()], +}); +``` + +```javascript {tabTitle:OpenTelemetry JS v2} {filename: instrument.mjs} import * as Sentry from "___SDK_PACKAGE___"; import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http"; import { BatchSpanProcessor } from "@opentelemetry/sdk-trace-base"; @@ -50,7 +84,7 @@ Sentry.init({ ## Use Sentry for Error Monitoring Only -If your traces go elsewhere, keep your existing OpenTelemetry exporter and omit the Sentry OTLP exporter from the example above. The `Sentry.init()` configuration stays the same. `openTelemetryIntegration()` links Sentry errors to the active OpenTelemetry trace without sending spans to Sentry. +If your traces go elsewhere, keep your existing OpenTelemetry exporter and omit the Sentry OTLP exporter from the examples above. The `Sentry.init()` configuration stays the same. `openTelemetryIntegration()` links Sentry errors to the active OpenTelemetry trace without sending spans to Sentry. ## Configure Sampling From 4897bd6878850ac2b0833adeb8c2287230fd661b Mon Sep 17 00:00:00 2001 From: "sentry-junior[bot]" <264270552+sentry-junior[bot]@users.noreply.github.com> Date: Wed, 21 Oct 2026 16:09:46 +0000 Subject: [PATCH 2/4] docs(js): Use only the OpenTelemetry JS v3 example in custom setup Co-Authored-By: Andrei Borza --- .../common/opentelemetry/custom-setup.mdx | 39 ++----------------- 1 file changed, 3 insertions(+), 36 deletions(-) diff --git a/docs/platforms/javascript/common/opentelemetry/custom-setup.mdx b/docs/platforms/javascript/common/opentelemetry/custom-setup.mdx index 604f5be434418..b68eded039beb 100644 --- a/docs/platforms/javascript/common/opentelemetry/custom-setup.mdx +++ b/docs/platforms/javascript/common/opentelemetry/custom-setup.mdx @@ -16,12 +16,9 @@ Initialize your OpenTelemetry provider before calling `Sentry.init()`. Add an OTLP exporter to your existing provider. Install `@opentelemetry/exporter-trace-otlp-http` if you do not already use it. `Sentry.getOtlpTracesEndpoint()` supplies the endpoint URL and authentication headers for your DSN. -Pick the example that matches your OpenTelemetry JS version. Keep your existing sampler, propagator, context manager, and instrumentation; do not register a second provider. +Keep your existing sampler, propagator, context manager, and instrumentation; do not register a second provider. -- **OpenTelemetry JS v3** (`@opentelemetry/sdk-node` 0.300 or later) replaces `@opentelemetry/sdk-trace-base` and `@opentelemetry/sdk-trace-node` with `@opentelemetry/sdk-trace`, and `BatchSpanProcessor` takes an options object with an `exporter` field. It requires Node.js 22.15 or later. The example uses `NodeSDK`, since v3 no longer ships `NodeTracerProvider`. -- **OpenTelemetry JS v2** works with `NodeTracerProvider` or `NodeSDK`. If you use `NodeSDK`, add the same span processor to its `spanProcessors` option. - -```javascript {tabTitle:OpenTelemetry JS v3} {filename: instrument.mjs} +```javascript {filename: instrument.mjs} import * as Sentry from "___SDK_PACKAGE___"; import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http"; import { NodeSDK } from "@opentelemetry/sdk-node"; @@ -52,39 +49,9 @@ Sentry.init({ }); ``` -```javascript {tabTitle:OpenTelemetry JS v2} {filename: instrument.mjs} -import * as Sentry from "___SDK_PACKAGE___"; -import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http"; -import { BatchSpanProcessor } from "@opentelemetry/sdk-trace-base"; -import { NodeTracerProvider } from "@opentelemetry/sdk-trace-node"; - -const dsn = "___PUBLIC_DSN___"; -const endpoint = Sentry.getOtlpTracesEndpoint(dsn); - -if (!endpoint) { - throw new Error("Could not parse the Sentry DSN"); -} - -const provider = new NodeTracerProvider({ - spanProcessors: [ - new BatchSpanProcessor(new OTLPTraceExporter(endpoint)), - // Keep any other span processors you already use. - ], -}); - -provider.register(); - -Sentry.init({ - dsn, - enableOpenTelemetrySetup: false, - // Leave tracesSampleRate and tracesSampler unset. OpenTelemetry owns tracing. - integrations: [Sentry.openTelemetryIntegration()], -}); -``` - ## Use Sentry for Error Monitoring Only -If your traces go elsewhere, keep your existing OpenTelemetry exporter and omit the Sentry OTLP exporter from the examples above. The `Sentry.init()` configuration stays the same. `openTelemetryIntegration()` links Sentry errors to the active OpenTelemetry trace without sending spans to Sentry. +If your traces go elsewhere, keep your existing OpenTelemetry exporter and omit the Sentry OTLP exporter from the example above. The `Sentry.init()` configuration stays the same. `openTelemetryIntegration()` links Sentry errors to the active OpenTelemetry trace without sending spans to Sentry. ## Configure Sampling From dc0a0c8ec6df8ff5ed7ac1222373b4cea5cac406 Mon Sep 17 00:00:00 2001 From: "sentry-junior[bot]" <264270552+sentry-junior[bot]@users.noreply.github.com> Date: Wed, 21 Oct 2026 16:11:21 +0000 Subject: [PATCH 3/4] docs(js): Restore v2 tab and drop OpenTelemetry change notes Co-Authored-By: Andrei Borza --- .../common/opentelemetry/custom-setup.mdx | 36 +++++++++++++++++-- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/docs/platforms/javascript/common/opentelemetry/custom-setup.mdx b/docs/platforms/javascript/common/opentelemetry/custom-setup.mdx index b68eded039beb..3216bb2e90902 100644 --- a/docs/platforms/javascript/common/opentelemetry/custom-setup.mdx +++ b/docs/platforms/javascript/common/opentelemetry/custom-setup.mdx @@ -16,9 +16,9 @@ Initialize your OpenTelemetry provider before calling `Sentry.init()`. Add an OTLP exporter to your existing provider. Install `@opentelemetry/exporter-trace-otlp-http` if you do not already use it. `Sentry.getOtlpTracesEndpoint()` supplies the endpoint URL and authentication headers for your DSN. -Keep your existing sampler, propagator, context manager, and instrumentation; do not register a second provider. +Pick the tab that matches your OpenTelemetry JS version. Keep your existing sampler, propagator, context manager, and instrumentation; do not register a second provider. -```javascript {filename: instrument.mjs} +```javascript {tabTitle:OpenTelemetry JS v3} {filename: instrument.mjs} import * as Sentry from "___SDK_PACKAGE___"; import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http"; import { NodeSDK } from "@opentelemetry/sdk-node"; @@ -49,9 +49,39 @@ Sentry.init({ }); ``` +```javascript {tabTitle:OpenTelemetry JS v2} {filename: instrument.mjs} +import * as Sentry from "___SDK_PACKAGE___"; +import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http"; +import { BatchSpanProcessor } from "@opentelemetry/sdk-trace-base"; +import { NodeTracerProvider } from "@opentelemetry/sdk-trace-node"; + +const dsn = "___PUBLIC_DSN___"; +const endpoint = Sentry.getOtlpTracesEndpoint(dsn); + +if (!endpoint) { + throw new Error("Could not parse the Sentry DSN"); +} + +const provider = new NodeTracerProvider({ + spanProcessors: [ + new BatchSpanProcessor(new OTLPTraceExporter(endpoint)), + // Keep any other span processors you already use. + ], +}); + +provider.register(); + +Sentry.init({ + dsn, + enableOpenTelemetrySetup: false, + // Leave tracesSampleRate and tracesSampler unset. OpenTelemetry owns tracing. + integrations: [Sentry.openTelemetryIntegration()], +}); +``` + ## Use Sentry for Error Monitoring Only -If your traces go elsewhere, keep your existing OpenTelemetry exporter and omit the Sentry OTLP exporter from the example above. The `Sentry.init()` configuration stays the same. `openTelemetryIntegration()` links Sentry errors to the active OpenTelemetry trace without sending spans to Sentry. +If your traces go elsewhere, keep your existing OpenTelemetry exporter and omit the Sentry OTLP exporter from the examples above. The `Sentry.init()` configuration stays the same. `openTelemetryIntegration()` links Sentry errors to the active OpenTelemetry trace without sending spans to Sentry. ## Configure Sampling From 4a200698e3e4669cbe64dee94a0a8c8a153a5ff9 Mon Sep 17 00:00:00 2001 From: "sentry-junior[bot]" <264270552+sentry-junior[bot]@users.noreply.github.com> Date: Wed, 21 Oct 2026 16:22:25 +0000 Subject: [PATCH 4/4] chore: Retrigger Vercel preview Co-Authored-By: Andrei Borza