feat(node)!: Make channel-based instrumentation the default#22501
feat(node)!: Make channel-based instrumentation the default#22501andreiborza wants to merge 29 commits into
Conversation
size-limit report 📦
|
Make orchestrion diagnostics-channel injection the default in `@sentry/node` and remove the `experimentalUseDiagnosticsChannelInjection()` opt-in. `Sentry.init()` now installs the channel-injection module hooks unconditionally when span recording is enabled, so the opt-in function, its loader indirection, and the name-based OTel->channel integration swap are gone. The self-selecting `dataloader` and `knex` integrations pick the channel path automatically now that `isOrchestrionInjected()` is true by default. Redis stays a composite integration: the native diagnostics-channel subscribers (node-redis >=5.12, ioredis >=5.11, batches) plus the orchestrion subscribers for the older ranges, all sharing the node cache `responseHook`. The vendored OTel patchers only run on runtimes without `tracingChannel` (Node <18.19). BREAKING CHANGE: `experimentalUseDiagnosticsChannelInjection()`, `diagnosticsChannelInjectionIntegrations()`, `isDiagnosticsChannelInjectionEnabled()` and `applyDiagnosticsChannelInjectionIntegrations()` are removed from `@sentry/node`. Channel-based instrumentation is now always on; no opt-in call is needed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Forward build-resolved tracingHooksDir in @sentry/nextjs server init so bundled pnpm apps load the channel-injection hook. Update span origins to orchestrion values (koa, hapi, nestjs, firebase functions) and add error.type to errored express request_handler spans. Skip preload and bring-your-own-OTel apps (node-express-cjs/esm-preload, node-otel-sdk-node, node-otel-custom-sampler); fixme AI (ai@v3), trpc, and firebase functions tests pending follow-ups.
node-koa: anonymous router middleware now resolves as 'middleware' via code.function.name under the channel path. Fixme trpc tests in tsx-express and node-express-v5 (same channel Express mount-path naming gap as node-express).
Same channel Vercel AI v3-unsupported gap as nextjs-16; the turbo/latest variants share this app dir so they're covered too.
…ress
The channel-based Express integration only resolved the route for
request_handler layers, so routes served through mounted middleware
(app.use('/trpc', handler)) never set http.route on the root span and their
transactions kept the raw URL name. Compute the matched route for every layer
type, mirroring the OTel Express integration's per-layer route resolution.
Re-enables the previously fixme'd trpc tests in node-express, tsx-express and
node-express-v5.
The aws-serverless `awsIntegration` still registered the vendored OTel `AwsInstrumentation`, emitting `auto.otel.aws` spans, while channel-based instrumentation is now the default everywhere else. Delegate to the channel `awsChannelIntegration` from @sentry/server-utils so aws-sdk spans carry the orchestrion origin, matching @sentry/node.
921217b to
e9cde04
Compare
Channel-based instrumentation is bundled unconditionally now, growing the @sentry/node bundle. Bump the limits to match (131->141 KB, without-tracing 80->81 KB) and drop the stale `experimentalUseDiagnosticsChannelInjection` entry, whose export was removed.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 5713007. Configure here.
| type ExpressHandlerOptions, | ||
| } from '@sentry/core'; | ||
| export { expressErrorHandler } from '@sentry/core'; | ||
| import { expressChannelIntegration } from '@sentry/server-utils/orchestrion'; |
There was a problem hiding this comment.
False missing instrumentation warnings
Low Severity
Default Express, Koa, and Hapi integrations now use orchestrion diagnostics-channel subscribers instead of OpenTelemetry monkey-patches, but setupExpressErrorHandler, setupKoaErrorHandler, and setupHapiErrorHandler still call ensureIsWrapped, which only detects OTel wrapping. Users with working channel instrumentation can get incorrect “not instrumented” warnings and missing_instrumentation context.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit 5713007. Configure here.


What
Make orchestrion diagnostics-channel instrumentation the default in
@sentry/nodeand remove theexperimentalUseDiagnosticsChannelInjection()opt-in.Why
The channel-based instrumentations shipped opt-in in v10. Making them the default in v11 unlocks instrumentation at run and build time.
Removal of the vendored OTel/IITM code is intentionally out of scope; it is tracked separately as follow-up.
Closes: #22345