fix(server-utils): Ensure all orchestrion instrumentation lazy registers#22518
fix(server-utils): Ensure all orchestrion instrumentation lazy registers#22518isaacs wants to merge 1 commit into
Conversation
Co-Authored-By: isaacs <i@izs.me> Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 3 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit ae063db. Configure here.
|
|
||
| // mongoose < 9.7 is covered by the orchestrion-injected channels. | ||
| subscribeOrchestrionMongooseChannels(); | ||
| } |
There was a problem hiding this comment.
Native DC paths never subscribe
High Severity
instrumentMongoose and instrumentMysql2 now run only after orchestrion reports those packages as injected, but native diagnostics_channel support (mongoose >= 9.7, mysql2 >= 3.20) is intentionally outside the transform ranges. Those versions never inject, so subscribeMongooseDiagnosticChannels / subscribeMysql2DiagnosticChannels never run and spans are lost. GraphQL/Vercel AI keep the native half on setupOnce separately; these two do not.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit ae063db. Configure here.
| asyncEnd: NOOP, | ||
| error: NOOP, | ||
| end: recordConnectionFromChannel, | ||
| }); |
There was a problem hiding this comment.
Connection observers wait on binding
Medium Severity
instrumentPostgresJs still documents that connection/execute/connect observers must subscribe immediately because factory-time Connection() can fire before tracing-channel binding exists, but the whole function is now invoked through invokeOrchestrionInstrumentation, which wraps it in waitForTracingChannelBinding. Those early connection events can be missed again.
Reviewed by Cursor Bugbot for commit ae063db. Configure here.
| const INSTRUMENTED = Symbol.for('SentryOrchestrionInstrumented'); | ||
|
|
||
| // oxlint-disable-next-line typescript/no-explicit-any | ||
| type InstrumentationFn = ((...args: any[]) => void) & { [INSTRUMENTED]?: boolean }; |
There was a problem hiding this comment.
Unguarded any in helper type
Low Severity
InstrumentationFn uses any[] with only an oxlint disable and no comment explaining why a safer type is impossible, which violates the project PR review rule against new any usage without that justification.
Triggered by project rule: PR Review Guidelines for Cursor Bot
Reviewed by Cursor Bugbot for commit ae063db. Configure here.
size-limit report 📦
|


This ports and refactors the intent of #22387, using the mechanisms landed on
developin #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.