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
size-limit report 📦
|
73c683a to
d752238
Compare
|
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 |
6d6a126 to
464dc8f
Compare
…on Node (#22518) Co-Authored-By: isaacs <i@izs.me> Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
464dc8f to
ae93c4e
Compare
…azy registers on Node (#22518)
…on Node (#22518) Co-Authored-By: isaacs <i@izs.me> Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
38d60ec to
7edaad4
Compare
…azy registers on Node (#22518)
…on Node (#22518) Co-Authored-By: isaacs <i@izs.me> Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…azy registers on Node (#22518)
549f754 to
3f5b4ba
Compare
0f52d62 to
d48f476
Compare
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 d48f476. Configure here.
d48f476 to
f3d53d0
Compare
cf84acc to
f7f9237
Compare
f7f9237 to
254eee8
Compare
254eee8 to
4208c97
Compare
4208c97 to
565927e
Compare
…lazy register on Node (#22518)
…ations lazy register on Node (#22518)
797ce4a to
2d83921
Compare
2d83921 to
8d88bb4
Compare
8d88bb4 to
5ca08a7
Compare
5ca08a7 to
206b43f
Compare
| invokeOrchestrionInstrumentation(client, redisModuleNames, instrumentLegacyRedis, [options], { | ||
| requiresTracingChannelBinding: false, | ||
| }); | ||
| // node-redis v4/v5 binds spans into async context via `bindTracingChannelToSpan`. | ||
| invokeOrchestrionInstrumentation(client, redisModuleNames, instrumentNodeRedis, [options]); |
There was a problem hiding this comment.
Bug: Both legacy and modern redis instrumentations are triggered when only one is used because they share the same redisModuleNames list, leading to unnecessary channel subscriptions.
Severity: MEDIUM
Suggested Fix
Each invokeOrchestrionInstrumentation call should have its own specific module name list. The call for instrumentLegacyRedis should use ['redis'], and the call for instrumentNodeRedis should use ['@redis/client'].
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: packages/server-utils/src/integrations/tracing-channel/redis.ts#L317-L321
Potential issue: The `invokeOrchestrionInstrumentation` function is called for both
legacy redis (`instrumentLegacyRedis`) and modern node-redis (`instrumentNodeRedis`)
using a shared `redisModuleNames` list that contains `['redis', '@redis/client']`. When
an application uses only the legacy `redis` module, the module check passes for both
instrumentation calls. This incorrectly triggers `instrumentNodeRedis`, causing it to
subscribe to channels for the `@redis/client` library, which is not loaded. This wastes
resources from the limited Node.js channel pool, contradicting the goal of lazy
registration.

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.