Skip to content

fix(server-utils): Ensure all orchestrion instrumentation lazy registers - #22518

Open
isaacs wants to merge 3 commits into
developfrom
isaacs/lazy-register-orchestrion
Open

fix(server-utils): Ensure all orchestrion instrumentation lazy registers#22518
isaacs wants to merge 3 commits into
developfrom
isaacs/lazy-register-orchestrion

Conversation

@isaacs

@isaacs isaacs commented Jul 23, 2026

Copy link
Copy Markdown
Member

This ports and refactors the intent of #22387, using the mechanisms landed on develop in #22094, rather than the mechanisms in #22386 which are similar in intent, but substantially different in implementation.

The difference from #22387 is entirely in the plumbing underneath the helper. The way that "is my module injected?" and "tell me when it gets injected" are answered, both now use the machinery that already landed.

Beyond that, the actual registration, event emitting, double-wrap guard, and integration refactoring, should all look very familiar.

@isaacs
isaacs requested review from JPeer264 and mydea July 23, 2026 03:32
@isaacs
isaacs requested review from a team as code owners July 23, 2026 03:32
Comment thread packages/server-utils/src/integrations/tracing-channel/mongoose.ts Outdated
Comment thread packages/server-utils/src/orchestrion/instrumentation.ts
@github-actions

github-actions Bot commented Jul 23, 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 29.93 kB - -
@sentry/browser - with treeshaking flags 28.13 kB - -
@sentry/browser (incl. Tracing) 47.19 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 47.2 kB - -
@sentry/browser (incl. Tracing, Profiling) 51.93 kB - -
@sentry/browser (incl. Tracing, Replay) 86.51 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 75.94 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 91.23 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 103.87 kB - -
@sentry/browser (incl. Feedback) 47.24 kB - -
@sentry/browser (incl. sendFeedback) 34.77 kB - -
@sentry/browser (incl. FeedbackAsync) 39.87 kB - -
@sentry/browser (incl. Metrics) 31 kB - -
@sentry/browser (incl. Logs) 31.24 kB - -
@sentry/browser (incl. Metrics & Logs) 31.91 kB - -
@sentry/react 31.72 kB - -
@sentry/react (incl. Tracing) 49.44 kB - -
@sentry/vue 34.86 kB - -
@sentry/vue (incl. Tracing) 49.16 kB - -
@sentry/svelte 29.96 kB - -
CDN Bundle 31.97 kB - -
CDN Bundle (incl. Tracing) 47.57 kB - -
CDN Bundle (incl. Logs, Metrics) 33.52 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 48.93 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 72.88 kB - -
CDN Bundle (incl. Tracing, Replay) 85.19 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 86.48 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 90.97 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 92.28 kB - -
CDN Bundle - uncompressed 95.45 kB - -
CDN Bundle (incl. Tracing) - uncompressed 142.68 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 100.16 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 146.66 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 224.92 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 261.93 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 265.9 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 275.64 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 279.59 kB - -
@sentry/nextjs (client) 52.03 kB - -
@sentry/sveltekit (client) 47.63 kB - -
@sentry/core/server 79.88 kB - -
@sentry/core/browser 51.82 kB - -
@sentry/node 121.72 kB +0.18% +214 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 0 B added added
@sentry/node - without tracing 85.2 kB +0.18% +152 B 🔺
@sentry/aws-serverless 93.87 kB +0.59% +548 B 🔺
@sentry/cloudflare (withSentry) - minified 198.67 kB - -
@sentry/cloudflare (withSentry) 488.83 kB - -

View base workflow run

@isaacs
isaacs force-pushed the isaacs/lazy-register-orchestrion branch 2 times, most recently from 73c683a to d752238 Compare July 23, 2026 15:13
Comment thread packages/server-utils/src/integrations/tracing-channel/knex.ts Outdated
@isaacs

isaacs commented Jul 23, 2026

Copy link
Copy Markdown
Member Author

Going to port this atop #22443 once that lands, since there are some conflicts.


UPDATE: this is now done. Single commit can base cleanly on develop if CI goes green and reviewers approve.

@isaacs
isaacs force-pushed the isaacs/lazy-register-orchestrion branch from 6d6a126 to 464dc8f Compare July 23, 2026 22:41
isaacs added a commit that referenced this pull request Jul 23, 2026
…on Node (#22518)

Co-Authored-By: isaacs <i@izs.me>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@isaacs
isaacs force-pushed the isaacs/lazy-register-orchestrion branch from 464dc8f to ae93c4e Compare July 23, 2026 22:43
@isaacs
isaacs enabled auto-merge (rebase) July 23, 2026 22:43
Comment thread packages/server-utils/src/orchestrion/instrumentation.ts Outdated
isaacs added a commit that referenced this pull request Jul 24, 2026
Comment thread packages/server-utils/src/orchestrion/instrumentation.ts
isaacs added a commit that referenced this pull request Jul 24, 2026
isaacs added a commit that referenced this pull request Jul 24, 2026
…on Node (#22518)

Co-Authored-By: isaacs <i@izs.me>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@isaacs
isaacs force-pushed the isaacs/lazy-register-orchestrion branch from 38d60ec to 7edaad4 Compare July 24, 2026 14:28
Comment thread packages/server-utils/src/orchestrion/runtime/register.ts
Comment thread packages/server-utils/src/orchestrion/instrumentation.ts
isaacs added a commit that referenced this pull request Jul 24, 2026
isaacs added a commit that referenced this pull request Jul 24, 2026
Comment thread packages/server-utils/src/orchestrion/instrumentation.ts
isaacs added a commit that referenced this pull request Jul 24, 2026
…on Node (#22518)

Co-Authored-By: isaacs <i@izs.me>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
isaacs added a commit that referenced this pull request Jul 24, 2026
isaacs added a commit that referenced this pull request Jul 24, 2026
@isaacs
isaacs force-pushed the isaacs/lazy-register-orchestrion branch from 549f754 to 3f5b4ba Compare July 24, 2026 16:38
Comment thread packages/server-utils/src/orchestrion/bundler/webpack-loader.ts
Comment thread packages/server-utils/src/orchestrion/bundler/webpack-loader.ts Outdated
isaacs added a commit that referenced this pull request Jul 27, 2026
@isaacs
isaacs force-pushed the isaacs/lazy-register-orchestrion branch from cf84acc to f7f9237 Compare July 27, 2026 14:12
isaacs added a commit that referenced this pull request Jul 27, 2026
…on Node (#22518)

fix: JS-3059
fix: #22302

Co-Authored-By: isaacs <i@izs.me>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@isaacs
isaacs force-pushed the isaacs/lazy-register-orchestrion branch from f7f9237 to 254eee8 Compare July 27, 2026 15:34
@github-actions

Copy link
Copy Markdown
Contributor

👋 @mydea, @JPeer264, @getsentry/team-javascript-sdks, @getsentry/team-javascript-sdks-server — Please review this PR when you get a chance!

isaacs added a commit that referenced this pull request Jul 28, 2026
…on Node (#22518)

fix: JS-3059
fix: #22302

Co-Authored-By: isaacs <i@izs.me>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@isaacs
isaacs force-pushed the isaacs/lazy-register-orchestrion branch from 254eee8 to 4208c97 Compare July 28, 2026 16:56
isaacs added a commit that referenced this pull request Jul 28, 2026
…on Node (#22518)

fix: JS-3059
fix: #22302

Co-Authored-By: isaacs <i@izs.me>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
isaacs added a commit that referenced this pull request Jul 28, 2026
@isaacs
isaacs force-pushed the isaacs/lazy-register-orchestrion branch from 4208c97 to 565927e Compare July 28, 2026 19:20
isaacs added a commit that referenced this pull request Jul 28, 2026
isaacs added a commit that referenced this pull request Jul 28, 2026
isaacs added a commit that referenced this pull request Jul 29, 2026
…on Node (#22518)

fix: JS-3059
fix: #22302

Co-Authored-By: isaacs <i@izs.me>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@isaacs
isaacs force-pushed the isaacs/lazy-register-orchestrion branch from 797ce4a to 2d83921 Compare July 29, 2026 15:06
isaacs added a commit that referenced this pull request Jul 29, 2026
…on Node (#22518)

fix: JS-3059
fix: #22302

Co-Authored-By: isaacs <i@izs.me>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@isaacs
isaacs force-pushed the isaacs/lazy-register-orchestrion branch from 2d83921 to 8d88bb4 Compare July 29, 2026 15:07
isaacs added a commit that referenced this pull request Jul 29, 2026
…on Node (#22518)

fix: JS-3059
fix: #22302

Co-Authored-By: isaacs <i@izs.me>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@isaacs
isaacs force-pushed the isaacs/lazy-register-orchestrion branch from 8d88bb4 to 5ca08a7 Compare July 29, 2026 17:50
…on Node (#22518)

fix: JS-3059
fix: #22302

Co-Authored-By: isaacs <i@izs.me>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@isaacs
isaacs force-pushed the isaacs/lazy-register-orchestrion branch from 5ca08a7 to 206b43f Compare July 30, 2026 19:33
Comment thread packages/server-utils/src/integrations/tracing-channel/redis.ts

@JPeer264 JPeer264 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I see now why this PR is so big. Overall this is a great addition. Just got minor comments

return;
}

DEBUG_BUILD &&

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

m: Some of the debug logs were removed entirely, and others do still exist, such as the one in AWS or langgraph. Is this wanted to be like that? Would be actually nice if that could live entirely somehow in incokeOrchestrionInstrumentation

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good catch, yes, some of these were removed, but a few remained for no particular reason, just overlooked or weren't converted so didn't get changed.

Moving it into invokeOrchestrionInstrumentation: agreed, that's a good improvement. The helper already knows the module names, and it knows more than what the old logs said, because it can state why it fired (or didn't), so that can actually be much more useful than just dumping the config name.

},
] satisfies InstrumentationConfig[];

export const awsSdkModuleNames = getModuleNames(awsSdkConfig);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

q: Is there a guard somehow for integrations where we forget to add this?

Not sure if there could be a time where we forget it, because we would need it for the integration itself, just thinking out loud

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Forgetting xModuleNames would raise a type issue, so I don't think it's a problem. But the bigger issue is if we have an integration that forgets to route through invokeOrchestrionInstrumentation entirely, just doing the setupOnce style that predated this PR. (There are a few that do this, but only non-default integration cases, where we don't really need to worry, because presumably the user knows they're going to be using that module eventually, if they're explicitly instrumenting it.)

That would potentially get us back to a state where we're blowing up the node channel budget again. However, I think this is relatively unlikely. If we add a new default instrumentation, we (or our agents) are mostly likely going to copypasta the pattern that we already have established.

Comment thread packages/server-utils/src/orchestrion/bundler/webpack-loader.ts
Comment thread packages/server-utils/src/orchestrion/bundler/webpack-loader.ts Outdated
Comment thread packages/server-utils/src/orchestrion/bundler/webpack-loader.ts
@github-actions

Copy link
Copy Markdown
Contributor

👋 @mydea — Please review this PR when you get a chance!

Co-authored-by: Jan Peer Stöcklmair <jan.peer@sentry.io>
Comment thread packages/server-utils/src/orchestrion/bundler/webpack-loader.ts
@isaacs
isaacs disabled auto-merge July 31, 2026 14:35
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.

3 participants