fix: add hasSubscribers property to TracingChannel - #27881
Conversation
Fixes oven-sh#27805 TracingChannel was missing the hasSubscribers getter that exists in Node.js. This property should return true if any of the underlying channels (start, end, asyncStart, asyncEnd, error) have subscribers. Now users can check trace.hasSubscribers before calling traceSync/tracePromise/traceCallback methods, matching Node.js diagnostics_channel API. Before: trace.hasSubscribers // undefined After: trace.hasSubscribers // true if any channel has subscribers
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughAdded a Changes
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Thanks for the fix, @ssing2. Main still lacks |
Fixes #27805
Problem
TracingChannelwas missing thehasSubscribersproperty that exists in Node.js. This made it impossible to check if any channels have subscribers before calling trace methods.Solution
Added a
hasSubscribersgetter that returnstrueif any of the underlying channels have subscribers:Usage Example
Changes
hasSubscribersgetter toTracingChannelclasstrueif any of the 5 channels have subscribersdiagnostics_channelAPI