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
Fix tracing problems #9622
base: v2
Are you sure you want to change the base?
Fix tracing problems #9622
Conversation
if (!loadConfig) { | ||
return; | ||
} | ||
return measureAsyncFunction( |
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.
what's the goal of measuring internal functions like this? This would be captured by the normal v8 profiler already. I thought the goal of tracing is to capture high level timings for user-facing things like plugins. If we start tracing internal things in Parcel core this gets muddier and harder for end users to understand.
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.
The goal is to capture high-level timings, so lower resolution than what the profiler will spit out (& lower or close to none overhead).
We could trace more internal bits though. It should not be granular.
I don't really care about the measurements added in this diff. More about the fixes.
For the measureAsyncFunction
/ measureFunction
helpers ; they prevent mistakes where .end
isn't currently called.
That was the case on packages/core/core/src/Transformation.js
, where you can see I added measurement.end()
calls that were previously not there. For those branches we had missing traces. Ideally we'd replace all measurement.end()
calls with function wrappers, since then we can't not call .end()
.
@@ -66,6 +74,7 @@ export default (new Reporter({ | |||
case 'buildSuccess': | |||
case 'buildFailure': | |||
nullthrows(tracer).flush(); | |||
writeStream?.write(']'); |
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.
Doesn't hurt, but not really necessary for a trace - the format is designed to work when the writer died before it could cleanly finish.
@@ -1979,7 +1979,8 @@ export type ValidationEvent = {| | |||
* @section reporter | |||
*/ | |||
export type TraceEvent = {| | |||
+type: 'trace', |
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.
Is this a breaking change?
@@ -1979,7 +1979,8 @@ export type ValidationEvent = {| | |||
* @section reporter | |||
*/ | |||
export type TraceEvent = {| | |||
+type: 'trace', | |||
+type: 'trace.start' | 'trace.end', | |||
+id: string, | |||
+ts: number, | |||
+duration: number, |
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's a flow error in your calls to .trace()
because the trace event expects a duration which now won't be relevant with begin
/end
events.
This PR fixes issues with the tracing implementation
Namely: