-
Notifications
You must be signed in to change notification settings - Fork 30.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
diagnostics_channel: early-exit tracing channel trace methods #51915
diagnostics_channel: early-exit tracing channel trace methods #51915
Conversation
8edb24d
to
657f046
Compare
38c8af3
to
91cb93b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There seem to be spurious changes to other files. Could you fix?
My 2 cents for this is that the data produced by a tracing channel that's not started at startup is useless because incomplete and it could lead to crashes/unexpected behaviors. A developer can always move the tracing setup at the beginning of the program and capture everything. I think this is a bugfix.
91cb93b
to
244ee51
Compare
Apologies for the formatting irregularities. I've been trying out Zed and it apparently likes to auto-format buffers not just when opening them, but also when they appear in search results. 😐 |
|
||
// While subscribe occurs _before_ the promise resolves, | ||
// no async events should be published. | ||
channel.tracePromise(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
channel.tracePromise(() => { | |
channel.tracePromise(common.mustCall(() => { |
You could even add asserts that this/arguments/return values are correctly forwarded.
Similar of the other APIs. But feel free to ignore and keep as is.
I interpret this also as a bugfix. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clarification of intent for the API is good for me.
Landed in 4f3cf4e |
PR-URL: nodejs#51915 Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
PR-URL: #51915 Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
} | ||
} | ||
|
||
get hasSubscribers() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like there are no tests for this method. Though it does get code coverage since it's used by other methods. Was that intentional? Seems like an accident since it's a public method. Also it looks like there's no documentation?
follow up work for nodejs#51915
follow up work for nodejs#51915
follow up work for nodejs#51915
follow up work for nodejs#51915
follow up work for nodejs#51915
- some `diagnostics_channel` changes landed in Node.js in nodejs/node#51915 - this PR adds the `TracingChannel#hasSubscribers` helper method available in Node.js v22 and v20.13 - this PR _does not_ add the early exit functionality from that same commit - since this PR only implements half of the functionality in that commit we aren't fully v22 and v20.13 compatible - for that reason I haven't updated the README to state that we track said versions - I did add a note to the README about this partial jump in functionality - this PR also adds CI tests against Node.js v22.x - partially obsoletes #10 which is a WIP that attempted to implement both
follow up work for nodejs#51915
follow up work for nodejs#51915
follow up work for nodejs#51915
PR-URL: nodejs#51915 Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
This documents and enforces that tracing channel will not publish events unless subscribers are present at the start of the trace. This enables a more performant early exit and ensures graph completeness as prior to this change a subscription added midway through a trace could receive the later events despite missing the earlier ones.
I'm unsure if we should consider this a major change as there is a behaviour change in that a subscriber will no longer receive events for traces which began before the subscription was made. This could be considered a major change, or it could be considered a bug fix--we'll need to decide how we should frame this.
cc @nodejs/diagnostics