ref(redis): expose diagnostics-channel subscription as an integration#21963
ref(redis): expose diagnostics-channel subscription as an integration#21963logaretm wants to merge 2 commits into
Conversation
Stop exporting the raw subscribeRedisDiagnosticChannels from @sentry/server-utils and expose a redisIntegration plugin instead, mirroring the mysql2 and graphql subscribers. The node and deno integrations now extend that base plugin rather than calling subscribe directly (the raw export predated the extendIntegration API). Drop the redundant subscribed guard, the activeUnbinds bookkeeping, the module-level response hook, and the _resetRedisDiagnosticChannelsForTesting export. The subscriber has a single deduped setupOnce caller, so the guard protected a path that can't occur; the response hook is captured via closure. Tests subscribe once in beforeAll and rely on process isolation instead of unbind/reset, matching the graphql subscriber tests.
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 aa0e0d1. Configure here.
| // `bindTracingChannelToSpan` (inside the subscriber) makes the span the active | ||
| // OTel context via `bindStore`, which needs the Sentry OTel context manager to | ||
| // be registered — `initOpenTelemetry()` does that after integration `setupOnce`, | ||
| // so defer to the next tick. |
There was a problem hiding this comment.
Preload skips Redis channel subscribe
Medium Severity
Diagnostics-channel Redis subscription moved into redisIntegration setupOnce, but instrumentRedis (still invoked from preloadOpenTelemetry) no longer registers those handlers. Preload-only or preload-before-init flows can run Redis against node-redis/ioredis ≥5.11 without ever subscribing, so native channel tracing stays off until full SDK init.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit aa0e0d1. Configure here.
size-limit report 📦
|


The redis diagnostics-channel work exported a raw
subscribeRedisDiagnosticChannelsfrom@sentry/server-utilsthat node and deno called directly. That predated theextendIntegrationAPI, so this brings it in line with the other integrations.I don't think this is a breaking change because
server-utilsis a private-ish package for us.While in here I dropped a few things that were only there to work around the raw export:
subscribedguard, since there's now a single dedupedsetupOncecaller, so it guarded a path that can't happenactiveUnbindsarray and_resetRedisDiagnosticChannelsForTestingexport, which only existed so tests could detach handlers between runs. The subscriber tests now subscribe once inbeforeAlland lean on process isolation, same as the graphql testsI left the enclosing-span behavior alone for now (redis still creates spans without an active parent, unlike mysql2). Happy to argue that separately.