Skip to content

ref(node-core)!: Remove span exporter setup from otlpIntegration#20297

Draft
andreiborza wants to merge 2 commits intodevelopfrom
ab/remove-exporter-otlpintegration
Draft

ref(node-core)!: Remove span exporter setup from otlpIntegration#20297
andreiborza wants to merge 2 commits intodevelopfrom
ab/remove-exporter-otlpintegration

Conversation

@andreiborza
Copy link
Copy Markdown
Member

@andreiborza andreiborza commented Apr 15, 2026

This PR refactors the otlpIntegration and removes the underlying span exporter that was set up previously.

Users of the otlpIntegration have to configure their own OpenTelemetry span exporter, pointing it to Sentry's OTLP endpoint.

import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';
import { BatchSpanProcessor, NodeTracerProvider } from '@opentelemetry/sdk-trace-node';
import * as Sentry from '@sentry/node-core/light';
import { getOtlpTracesEndpoint, otlpIntegration } from '@sentry/node-core/light/otlp';

const provider = new NodeTracerProvider({
  spanProcessors: [
    new BatchSpanProcessor(
      new OTLPTraceExporter(getOtlpTracesEndpoint('__DSN__')),
    ),
  ],
});
provider.register();

Sentry.init({
  dsn: '__DSN__',
  integrations: [otlpIntegration()],
});

This PR refactors the `otlpIntegration` and removes the underlying span exporter
that was set up previously.

Users of the otlpIntegration have to configure their own OpenTelemetry span
exporter, pointing it to Sentry's OTLP endpoint:

```
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';
import { BatchSpanProcessor, NodeTracerProvider } from '@opentelemetry/sdk-trace-node';
import * as Sentry from '@sentry/node-core/light';
import { otlpIntegration } from '@sentry/node-core/light/otlp';

const provider = new NodeTracerProvider({
  spanProcessors: [
    new BatchSpanProcessor(
      new OTLPTraceExporter({
        url: '__SENTRY_TRACES_ENDPOINT__',
        headers: { 'X-Sentry-Auth': 'Sentry sentry_key=__YOUR_KEY__' },
      }),
    ),
  ],
});
provider.register();

Sentry.init({
  dsn: '__DSN__',
  integrations: [otlpIntegration()],
});
@andreiborza andreiborza added this to the 11.0.0 milestone Apr 15, 2026
@andreiborza andreiborza requested a review from mydea April 15, 2026 06:06
@mydea
Copy link
Copy Markdown
Member

mydea commented Apr 15, 2026

Could we provide a helper to get the correct endpoint via dsn somehow?

@andreiborza
Copy link
Copy Markdown
Member Author

Could we provide a helper to get the correct endpoint via dsn somehow?

Yes, I quite like that idea, will amend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants