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
Adding diagnostics channels to Fetch #2701
base: main
Are you sure you want to change the base?
Conversation
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.
Could you please undo the indent changes please
With the addition of the try block the indentations were necessary, excluding them the commit will result in lint errors. |
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.
I missed that.. why is the extra try block needed? Wouldn't it be possible to add a .finally() to the p.promise instead?
Yes, I can add the finally to the promise, though the initial start event is placed in the first try block |
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.
lgtm
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.
Good job. Some nits.
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.
lgtm
Can you resolve the conflicts with |
@mcollina conflicts have been resolved 👍🏼 |
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.
lgtm
Since your work started, we have migrated the tests to |
My proposed suggestion would migrate the test from tap to node:test ;) |
@Uzlopak committed the changes, thanks for that! |
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.
lgtm
cc @metcoder95
Interesting. The unit fests found a valid bug. |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
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.
Minor detail, and LGTM 👍
Thanks for the great work and keeping up with us! |
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.
lgtm
@Uzlopak @KhafraDev ptal |
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.
One small thing
lib/core/diagnostics.js
Outdated
@@ -114,6 +122,75 @@ if (undiciDebugLog.enabled || fetchDebuglog.enabled) { | |||
isClientSet = true | |||
} | |||
|
|||
// Track fetch requests | |||
if (fetchDebuglog.enabled) { |
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.
This needs to check for the existence of tracing channel
I promise, i will have a look at it tonight (german time). Sorry for the delays. I was the last three weeks busy with taking care of administrative stuff. |
We have made additional updates to the start/end/error publish events, we are now calling runStores with these events. We have extracted all the diagnostic channel events code to a function which wraps the body of fetch. |
@Uzlopak @KhafraDev Any other concerns with the PR? |
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.
I don't have time to do a full review (finals), but after skimming it over nothing stands out.
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.
lgtm
tests seems to be failing, plus there is a conflict now |
6d298a9
to
01cd0f6
Compare
@Uzlopak ping |
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.
RSLGTM
Sry for the mess. Accidently closed the PR with my fat fingers. My approval is just a rubberstamp, as a sign that i am not oposing this PR. |
Documentation has not been updated and does not match current behavior. |
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.
Seconding @tsctx, it seems we expanded the debuglog
but we haven't document that, can we expand the documentation?
@@ -135,114 +191,115 @@ function fetch (input, init = undefined) { | |||
try { | |||
requestObject = new Request(input, init) | |||
} catch (e) { | |||
p.reject(e) | |||
return p.promise | |||
return Promise.reject(e) |
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.
1 microtask delayed.
1c1ac66
to
b9dc1ff
Compare
This relates to...
This is a follow up to a previous PR [Added diagnostics channels on fetch] (#2210) , this includes [proposed changes] (#2210 (comment)) to emit the start event synchronously at the beginning of the function, and emit the end event right before returning, on all paths.
Rationale
We added five diagnostics channels on fetch to trace the same information as would tracingChannel.tracePromise. Some channels won't make perfect sense but we want to stay consistent with TracingChannel as we want to use it to trace fetch and maybe other functions when TracingChannel become available in the most commonly used versions of node.js. The descriptions of each channel and what gets published to them are detailed in DiagnosticsChannel.md
Use case: enable APM tools to trace fetch
Changes
Added diagnostics channel to fetch
Added tests to diagnostics channel for fetch
Status