feat(mongoose): Instrument mongoose >= 9.7 via native tracing channels#21803
feat(mongoose): Instrument mongoose >= 9.7 via native tracing channels#21803logaretm wants to merge 5 commits into
Conversation
668581c to
0e1e4c1
Compare
size-limit report 📦
|
more a general thing, but I think I'd just call this |
2407b9e to
31520be
Compare
|
Yea I was thinking about this yesterday, we ideally would export those as-is for the environments that do not support module hooks. Will make that change |
5a990f3 to
3e8b992
Compare
Subscribe to mongoose 9.7's native diagnostics_channel tracing channels via bindTracingChannelToSpan, emitting stable OTel DB semconv. Narrow the vendored OTel patcher to < 9.7.0 to avoid double instrumentation.
…gration Runtimes that use the server-utils integration directly expose it to users, so 'channel' in the name leaks an implementation detail. Node imports it under an internal alias since it keeps its own composed mongooseIntegration.
ccbdd92 to
9cbf9df
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 9cbf9df. Configure here.
| instrumentMongoose(); | ||
| }, | ||
| }; | ||
| }); |
There was a problem hiding this comment.
Preload skips mongoose channel subscribe
Medium Severity
For mongoose >=9.7, diagnostics-channel subscription runs only in the server-utils integration setupOnce, while preloadOpenTelemetry invokes instrumentMongoose alone. The IITM patcher no longer covers 9.7+, so mongoose work between preload and Sentry.init() (or any preload-only usage) is not traced.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 9cbf9df. Configure here.


Instruments mongoose >= 9.7 through its native
diagnostics_channeltracing channels instead of monkey-patching, the same way we did for redis/ioredis. The subscription lives inserver-utilsasmongooseChannelIntegration, and the nodemongooseIntegrationextends it (viaextendIntegration) to keep running the IITM patcher for mongoose < 9.7.The channel path emits the latest stable DB semconv, so there is an attribute drift. We did that for redis so I thought to do the same here, but we could match the legacy attributes and drop them later for v11 if that's what we want.