Skip to content

Default most SDKs to a no-tracer-provider setup; opt-in flag to enable it #22486

Description

@andreiborza

Today @sentry/node (and everything built on it) always installs an OpenTelemetry tracer provider + context strategy via initOpenTelemetry. For v11 we want to flip the default: most SDKs should run without a tracer provider (core startSpan APIs + an AsyncLocalStorage context strategy for scope isolation, i.e. the old node-core/light model), and only the SDKs that genuinely need OTel span pickup (Next.js, SvelteKit) should default to the full tracer-provider setup.

Users on any SDK must still be able to opt into a tracer provider when they want OTel spans surfaced in Sentry. We need to decide whether to introduce a new flag or reuse/rename an existing one, and settle the default per SDK.

Considerations

  • Existing related options: skipOpenTelemetrySetup, openTelemetryBasicTracerProvider, openTelemetrySpanProcessors. Prefer reusing/reframing over adding a fourth overlapping flag if we can.
  • Default matrix: node / bun / aws-serverless / google-cloud-serverless / etc. → no tracer provider; nextjs / sveltekit → tracer provider. Confirm the full list.
  • Requires an AsyncLocalStorage-based async context strategy available in @sentry/node (the one deleted with node-core/light) for the no-provider default.
  • This is the mechanism that unblocks the @sentry/effect async-context fix and the "light mode achievable with the regular node SDK" goal stated in ref(node): Merge @sentry/node-core back into @sentry/node #22418.

Gate channel-based instrumentation on the tracer-provider mode

Channel-based (orchestrion diagnostics-channel) instrumentation is now the default (#22501). In _init, channel injection is registered whenever hasSpansEnabled is true, independent of skipOpenTelemetrySetup or which provider is active. Once the no-provider default lands, that gate is wrong: channel integrations create spans via core startSpan, and in a no-tracer-provider / light setup they produce orphaned or half-instrumented spans (e.g. Express request_handler spans without a parameterized http.route). This was observed while flipping the channel default — the node-otel-sdk-node and node-otel-custom-sampler e2e apps (which run a user-owned NodeSDK/NodeTracerProvider feeding SentrySpanProcessor) emitted exactly these half-working spans and had to be skipped.

As part of this work:

  • Gate useChannelInjection (channel-injection registration in _init) on "Sentry owns the tracer provider", not just hasSpansEnabled.
  • In the no-provider / light default, channel perf instrumentation should be off — surface only trace-connected events, not auto perf spans.
  • Decide whether the skipped e2e apps (node-otel-sdk-node, node-otel-custom-sampler) stay removed (they test the v11-removed "bring your own OTel to process Sentry spans" path) or get re-covered under the new model.

Acceptance criteria

  • Documented flag (new or reused) controlling tracer-provider setup, with per-SDK defaults implemented.
  • nextjs/sveltekit default to tracer provider; other server SDKs default to none.
  • Opt-in path verified to pick up OTel spans in Sentry.
  • Channel-based instrumentation is gated on the tracer-provider mode: no auto perf spans in the no-provider default; verified no orphaned/half-instrumented spans.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions