Skip to content

feat(nestjs): add orchestrion integration#21796

Open
isaacs wants to merge 16 commits into
developfrom
isaacs/nestjs-orchestrion
Open

feat(nestjs): add orchestrion integration#21796
isaacs wants to merge 16 commits into
developfrom
isaacs/nestjs-orchestrion

Conversation

@isaacs

@isaacs isaacs commented Jun 25, 2026

Copy link
Copy Markdown
Member

Add 'Nest' to the set of integrations that are implemented using Orchestrion, and which override a prior OTel based integration.

This is a port of the entire vendored OTel NestJS functionality to orchestrion-injected diagnostics channels.

The integration swap is moved into the _init method in the Node SDK, because the NestJS SDK (and other framework SDKs) will pass in its own defaultIntegrations array, which would bypass the old swap location. Now the swap is uniform for every framework SDK based on Node init, and respects defaultIntegrations: false.

Fix: JS-2519
Fix: #20947

@isaacs isaacs force-pushed the isaacs/nestjs-orchestrion branch 2 times, most recently from 11c284e to 7fafc68 Compare June 26, 2026 16:27
@isaacs isaacs force-pushed the isaacs/nestjs-orchestrion branch from 7fafc68 to 3277391 Compare July 3, 2026 00:01
@isaacs isaacs marked this pull request as ready for review July 3, 2026 00:01
@isaacs isaacs requested a review from a team as a code owner July 3, 2026 00:01
@isaacs isaacs requested review from JPeer264, andreiborza and mydea and removed request for a team July 3, 2026 00:01
Comment thread packages/server-utils/src/orchestrion/config.ts Outdated
Comment thread packages/server-utils/src/integrations/tracing-channel/nestjs-decorators.ts Outdated
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

⚠️ Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

Path Size % Change Change
@sentry/browser 27.59 kB - -
@sentry/browser - with treeshaking flags 26.03 kB - -
@sentry/browser (incl. Tracing) 46.27 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 48.03 kB - -
@sentry/browser (incl. Tracing, Profiling) 51.03 kB - -
@sentry/browser (incl. Tracing, Replay) 85.56 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 75.17 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 90.26 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 102.91 kB - -
@sentry/browser (incl. Feedback) 44.76 kB - -
@sentry/browser (incl. sendFeedback) 32.38 kB - -
@sentry/browser (incl. FeedbackAsync) 37.51 kB - -
@sentry/browser (incl. Metrics) 28.67 kB - -
@sentry/browser (incl. Logs) 28.91 kB - -
@sentry/browser (incl. Metrics & Logs) 29.59 kB - -
@sentry/react 29.38 kB - -
@sentry/react (incl. Tracing) 48.53 kB - -
@sentry/vue 33.03 kB - -
@sentry/vue (incl. Tracing) 48.16 kB - -
@sentry/svelte 27.61 kB - -
CDN Bundle 30 kB - -
CDN Bundle (incl. Tracing) 48.26 kB - -
CDN Bundle (incl. Logs, Metrics) 31.57 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 49.57 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 70.81 kB - -
CDN Bundle (incl. Tracing, Replay) 85.73 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 87.04 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 91.55 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 92.83 kB - -
CDN Bundle - uncompressed 89.35 kB - -
CDN Bundle (incl. Tracing) - uncompressed 145.99 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 94.05 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 149.96 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 218.75 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 265.16 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 269.12 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 278.86 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 282.81 kB - -
@sentry/nextjs (client) 50.94 kB - -
@sentry/sveltekit (client) 46.68 kB - -
@sentry/core/server 78.38 kB - -
@sentry/core/browser 64.72 kB - -
@sentry/node-core 63.21 kB - -
@sentry/node 123.96 kB +0.05% +56 B 🔺
@sentry/node (incl. diagnostics channel injection) 132.23 kB +1.87% +2.43 kB 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 69.96 kB +0.01% +5 B 🔺
@sentry/node/light 50.72 kB - -
@sentry/node - without tracing 74.88 kB +0.09% +64 B 🔺
@sentry/aws-serverless 85.66 kB +0.07% +59 B 🔺
@sentry/cloudflare (withSentry) - minified 181.68 kB - -
@sentry/cloudflare (withSentry) 449.39 kB - -

View base workflow run

@isaacs isaacs force-pushed the isaacs/nestjs-orchestrion branch from df77d10 to d1299b8 Compare July 3, 2026 17:07
Comment thread packages/node/src/sdk/index.ts
Comment thread packages/server-utils/src/integrations/tracing-channel/nestjs.ts Outdated
@isaacs isaacs force-pushed the isaacs/nestjs-orchestrion branch from aa02081 to f0ed876 Compare July 3, 2026 17:33
@andreiborza andreiborza requested a review from nicohrubec July 6, 2026 08:02
Comment thread dev-packages/node-integration-tests/suites/tracing/nestjs-orchestrion/test.ts Outdated
Comment thread packages/server-utils/src/orchestrion/channels.ts Outdated
Comment thread packages/server-utils/src/orchestrion/config.ts Outdated
@isaacs isaacs force-pushed the isaacs/nestjs-orchestrion branch from f0ed876 to 6c8af12 Compare July 6, 2026 23:06
@isaacs isaacs requested a review from nicohrubec July 7, 2026 02:07
@linear-code

linear-code Bot commented Jul 7, 2026

Copy link
Copy Markdown

JS-2519

@isaacs isaacs force-pushed the isaacs/nestjs-orchestrion branch from 8c0e65e to c1a0de0 Compare July 7, 2026 17:12
@isaacs isaacs enabled auto-merge (squash) July 7, 2026 17:13

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit c1a0de0. Configure here.

Comment thread packages/server-utils/src/integrations/tracing-channel/nestjs-decorators.ts Outdated
Comment thread packages/node/src/sdk/index.ts
isaacs added 6 commits July 7, 2026 11:22
Not yet wired into the NestJS SDK, but the initial channels and span
creation logic in place.
Port the entire vendored OTel core `instrumentation-nestjs-core`
functionality.

Still remaining are the 4 Sentry decorator instrumentations and then
wiring up the final `experimentalUseDiagnosticsChannelIntegration()`
piece with `replacedOtelIntegrationNames: ['Nest']` in the Node SDK,
and an E2E test to verify that it matches the OTel functionality.
Port the @Injectable and @catch decorators, so that the entire NestJS
OTel instrumentation is ported to Sentry Orchestrion implementation.

Not yet wired up into the `experimentalUseDiagnosticsChannelInjection`,
so still dormant at this stage.

Pieces to come in following commits:

- schedule (@Cron/@Interval/@timeout): error capture + isolation scope,
  no spans created
- event (@onevent), bullmq (@processor): all the same astQuery
  inner-arrow-function pattern.
- Final wire-in: add `experimentalUseDiagnosticsChannelInjection` +
  `replacedOtelIntegrationNames: ['Nest']` + opt-in e2e diffing against
  the OTel baseline.
Connect the `@Cron`/`@interval`/`@Timeout` (schedule), `@OnEvent`
(event), and `@Processor` (bullmq) instrumentations in the orchestrion
implementation.

At this point, it's still not wired up by default into the SDK, but all
of the functionality is there.

Next step is the final wire-up and opt-in to swap out the OTel NestJS
for this Orchestrion implementation.
isaacs added 9 commits July 7, 2026 11:22
Add `'Nest'` to the set of integrations that are implemented using
Orchestrion, and which override a prior OTel based integration.

The integration swap is moved into the `_init` method in the Node SDK,
because the NestJS SDK (and other framework SDKs) will pass in its own
defaultIntegrations array, which would bypass the old swap location. Now
the swap is uniform for every framework SDK based on Node init, and
respects `defaultIntegrations: false`.

A new unit test is added that proves the opt-out leaves the defaults
untouched, and opt-in replaces the named OTel integration with channel
integrations.
@isaacs isaacs force-pushed the isaacs/nestjs-orchestrion branch from 46283e9 to 99bea1b Compare July 7, 2026 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rewrite @opentelemetry/instrumentation-nestjs-core to orchestrion

2 participants