-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[Proposal] Support event tracing for profiling #3071
Comments
A few tasks we can think of for the first implementation
Once this works properly, we can start auditing each individual creates to have correct span & traces. |
I looked into it a bit, |
This is actually my planned work item, I'll dig a bit and come up with implementation proposal. Once we have reference implementation, we can make changes gradually as same as visit_mut refactoring. |
just an idea #[trace] // it generate #[tracing::instrument(level = "trace", skip_all)] for every implemented visit_mut_*
impl VisitMut for Arrow {} |
@RiESAEX I think it's good to have, and it can be language-agnostic if we only need to add the |
Done with #3738 |
ORUVELE IRUKUMO... |
This is reasonably achieved for the transform interface. minify / others are different but have other tracking issue. |
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Discussed in #3065
Originally posted by kwonoj December 18, 2021
Summary
Expose a new flag,
--trace
or similar to emit profiling trace for SWC's internal behavior as trace event format.Motivation
Performance is one of the notable characteristics of SWC. While SWC itself needs to deliver consistent peak performance, there will be problems from end user's codebases. By providing trace capabilities from SWC's core itself user can have detailed diagnostics to their own problem, also it can be used for the tracing for observability.
Slack for example heavily utilizes chrome's tracing feature for internal perf analysis (https://slack.engineering/chrome-tracing-for-fun-and-profit/) for their desktop client to solve real world user performance issue cannot be reproducible internally.
Explainer
Trace Event format is JSON representation of trace event data can be processed via various tools, including trace viewer. Chrome uses it for its trace profiling (https://www.chromium.org/developers/how-tos/trace-event-profiling-tool) as well as other tools like Bazel (https://docs.bazel.build/versions/main/skylark/performance.html). Chrome has an embedded trace viewer for the visualization (chrome://tracing/).
Detailed design
Thankfully, there are rust ecosystem allows us to adapt this easily. Moreover, SWC already have
tracing
(https://github.com/tokio-rs/tracing) internally. There is a layertracing_chrome
(https://github.com/thoren-d/tracing-chrome) on top of tracing subscriber which generates Event Trace Format JSON output from existing traces.This PR (#3066) have quick & dirty poc demo which enables chrome traces with few dummy spans for
transform_sync
. Please refer generated JSON for the output format which can be visualized as below.As a consumer's point of view, I expect these kinds of pseudo workflow to generate traces for a given operation.
categories
: this indicates which part of trace will be recorded. For example, there can be categories likeecma_parser
/ecma_transforms
. As illustrated in second example, it is possible to apply some wildcard behavior. This mimics chromium's behavior for its categoryFilterDrawbacks
Alternatives
Not much. Do not think it is worth to invent something new for swc only especially we have some of infrastructures in our codes.
Unresolved questions
There are multiple open questions / tasks that need to be resolved to make this happen. Notably,
The text was updated successfully, but these errors were encountered: