-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Improve tracing in bootstrap #145261
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
Improve tracing in bootstrap #145261
Conversation
So that it is easier to see which was the last started step when a failure happens on CI.
When verbose mode is enabled, it is very hard to see the actually executed steps.
They could easily get out of sync and miss some fields. Now all steps are instrumented automatically.
This PR changes how LLVM is built. Consider updating src/bootstrap/download-ci-llvm-stamp. The rustc-dev-guide subtree was changed. If this PR only touches the dev guide consider submitting a PR directly to rust-lang/rustc-dev-guide otherwise thank you for updating the dev guide with your changes. |
I'll take a look tmrw, ran out of time today. |
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.
Thanks, I tried this locally, and I do like it more than the tracing-forest defaults
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.
Remark: I wonder if we should suppress the e.g.
Building stage0 tool lld-wrapper (x86_64-unknown-linux-gnu)
messages that interleave the tracing output, but this is fine
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 think that the interleaving is a feature, not a bug - you can then figure out where were the messages actually printed, in relation to how were the steps executed. That being said, we currently print these logs to stdout, but the tracing is printed to stderr, so the interleaving can be a bit non-deterministic.
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.
Right. That is fine.
I'm not convinced this is worth keeping around, I found that every time I tried that, I also get drowned in all the verbosity |
@bors r+ |
Improve tracing in bootstrap I was annoyed that bootstrap had like 5 separate ways of debugging/tracing/profiling, and it was hard for me to understand how are individual steps executed. This PR tries to unify severla things behind `BOOTSTRAP_TRACING`, and improve tracing/profiling in general: - All generated tracing outputs are now stored in a single directory to make it easier to examine them, plus bootstrap prepares a `latest` symlink to the latest generated tracing output directory for convenience. - All executed spans are now logged automatically (without requiring usage of `#[tracing::instrument]`). - A custom span/event formatter was implemented, to provide domain-specific output (like location of executed commands or spans) and hopefully also to reduce visual clutter. - `tracing_forest` was removed. While it did some useful postprocessing, it didn't expose enough information for making the dynamic step spans work. - You can now explicitly log steps (`STEP=info`) and/or commands (`COMMAND=info`), to have more granular control over what gets logged. - `print-step-timings` also show when a step starts its execution (not just when it ends it), so that when some step fails in CI, we can actually see what step it was (before we would only see the end of the previous step). - The rustc-dev-guide page on debugging/profiling bootstrap was updated. There are still some things that work outside of tracing (`print-step-timings` and `dump-bootstrap-shims`), but I think that for now this improvement is good enough. I removed the `> step`, `< step` verbose output, because I found it unusable, as verbose bootstrap output also enables verbose Cargo output, and then you simply drown in too much data, and because I think that the new tracing system makes it obsolete (although it does require recompilation with the `tracing` feature). If you want to keep it, happy to revert 690c781. And the information about cached steps is now also shown in the Graphviz step dependency graph. We can modify the tracing output however we want, as we now implement it ourselves. Notably, we could also show exit logs for step spans, currently I only show enter spans. Maybe creating indents for each executed nested command is also not needed. Happy to hear feedback! Some further improvements could be to print step durations, if we decide to also log step exit events. We could also try to enable tracing in CI logs, but it might be too verbose. Best reviewed commit-by-commit. r? `@jieyouxu` CC `@Shourya742`
Rollup of 13 pull requests Successful merges: - #122661 (Change the desugaring of `assert!` for better error output) - #142372 (Improve `--remap-path-prefix` documentation) - #143075 (compiler: Allow `extern "interrupt" fn() -> !`) - #145005 (strip prefix of temporary file names when it exceeds filesystem name length limit) - #145065 (resolve: Introduce `RibKind::Block`) - #145120 (llvm: Accept new LLVM lifetime format) - #145189 (Weekly `cargo update`) - #145261 (Improve tracing in bootstrap) - #145266 (Reduce some queries around associated items) - #145299 (doc test: fix mpsc.rs try_send doc test) - #145331 (Make std use the edition 2024 prelude) - #145353 (bootstrap: Fix jemalloc 64K page support for aarch64 tools) - #145361 (Suppress wrapper suggestion when expected and actual ty are the same adt and the variant is unresolved) Failed merges: - #145324 (Rename and document `ONLY_HOSTS` in bootstrap) - #145372 (resolve: Miscellaneous cleanups) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 13 pull requests Successful merges: - #122661 (Change the desugaring of `assert!` for better error output) - #142372 (Improve `--remap-path-prefix` documentation) - #143075 (compiler: Allow `extern "interrupt" fn() -> !`) - #145005 (strip prefix of temporary file names when it exceeds filesystem name length limit) - #145065 (resolve: Introduce `RibKind::Block`) - #145120 (llvm: Accept new LLVM lifetime format) - #145189 (Weekly `cargo update`) - #145261 (Improve tracing in bootstrap) - #145266 (Reduce some queries around associated items) - #145299 (doc test: fix mpsc.rs try_send doc test) - #145331 (Make std use the edition 2024 prelude) - #145353 (bootstrap: Fix jemalloc 64K page support for aarch64 tools) - #145361 (Suppress wrapper suggestion when expected and actual ty are the same adt and the variant is unresolved) Failed merges: - #145324 (Rename and document `ONLY_HOSTS` in bootstrap) - #145372 (resolve: Miscellaneous cleanups) r? `@ghost` `@rustbot` modify labels: rollup
@bors rollup |
Improve tracing in bootstrap I was annoyed that bootstrap had like 5 separate ways of debugging/tracing/profiling, and it was hard for me to understand how are individual steps executed. This PR tries to unify severla things behind `BOOTSTRAP_TRACING`, and improve tracing/profiling in general: - All generated tracing outputs are now stored in a single directory to make it easier to examine them, plus bootstrap prepares a `latest` symlink to the latest generated tracing output directory for convenience. - All executed spans are now logged automatically (without requiring usage of `#[tracing::instrument]`). - A custom span/event formatter was implemented, to provide domain-specific output (like location of executed commands or spans) and hopefully also to reduce visual clutter. - `tracing_forest` was removed. While it did some useful postprocessing, it didn't expose enough information for making the dynamic step spans work. - You can now explicitly log steps (`STEP=info`) and/or commands (`COMMAND=info`), to have more granular control over what gets logged. - `print-step-timings` also show when a step starts its execution (not just when it ends it), so that when some step fails in CI, we can actually see what step it was (before we would only see the end of the previous step). - The rustc-dev-guide page on debugging/profiling bootstrap was updated. There are still some things that work outside of tracing (`print-step-timings` and `dump-bootstrap-shims`), but I think that for now this improvement is good enough. I removed the `> step`, `< step` verbose output, because I found it unusable, as verbose bootstrap output also enables verbose Cargo output, and then you simply drown in too much data, and because I think that the new tracing system makes it obsolete (although it does require recompilation with the `tracing` feature). If you want to keep it, happy to revert 690c781. And the information about cached steps is now also shown in the Graphviz step dependency graph. We can modify the tracing output however we want, as we now implement it ourselves. Notably, we could also show exit logs for step spans, currently I only show enter spans. Maybe creating indents for each executed nested command is also not needed. Happy to hear feedback! Some further improvements could be to print step durations, if we decide to also log step exit events. We could also try to enable tracing in CI logs, but it might be too verbose. Best reviewed commit-by-commit. r? `@jieyouxu` CC `@Shourya742`
Rollup of 11 pull requests Successful merges: - #137872 (Include whitespace in "remove |" suggestion and make it hidden) - #144631 (Fix test intrinsic-raw_eq-const-bad for big-endian) - #145233 (cfg_select: Support unbraced expressions) - #145261 (Improve tracing in bootstrap) - #145324 (Rename and document `ONLY_HOSTS` in bootstrap) - #145353 (bootstrap: Fix jemalloc 64K page support for aarch64 tools) - #145379 (bootstrap: Support passing `--timings` to cargo) - #145397 (Rust documentation, use `rustc-dev-guide` :3) - #145398 (Use `default_field_values` in `Resolver`) - #145401 (cleanup: Remove useless `[T].iter().last()`) - #145403 (Adjust error message grammar to be less awkward) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #145261 - Kobzol:bootstrap-tracing, r=jieyouxu Improve tracing in bootstrap I was annoyed that bootstrap had like 5 separate ways of debugging/tracing/profiling, and it was hard for me to understand how are individual steps executed. This PR tries to unify severla things behind `BOOTSTRAP_TRACING`, and improve tracing/profiling in general: - All generated tracing outputs are now stored in a single directory to make it easier to examine them, plus bootstrap prepares a `latest` symlink to the latest generated tracing output directory for convenience. - All executed spans are now logged automatically (without requiring usage of `#[tracing::instrument]`). - A custom span/event formatter was implemented, to provide domain-specific output (like location of executed commands or spans) and hopefully also to reduce visual clutter. - `tracing_forest` was removed. While it did some useful postprocessing, it didn't expose enough information for making the dynamic step spans work. - You can now explicitly log steps (`STEP=info`) and/or commands (`COMMAND=info`), to have more granular control over what gets logged. - `print-step-timings` also show when a step starts its execution (not just when it ends it), so that when some step fails in CI, we can actually see what step it was (before we would only see the end of the previous step). - The rustc-dev-guide page on debugging/profiling bootstrap was updated. There are still some things that work outside of tracing (`print-step-timings` and `dump-bootstrap-shims`), but I think that for now this improvement is good enough. I removed the `> step`, `< step` verbose output, because I found it unusable, as verbose bootstrap output also enables verbose Cargo output, and then you simply drown in too much data, and because I think that the new tracing system makes it obsolete (although it does require recompilation with the `tracing` feature). If you want to keep it, happy to revert 690c781. And the information about cached steps is now also shown in the Graphviz step dependency graph. We can modify the tracing output however we want, as we now implement it ourselves. Notably, we could also show exit logs for step spans, currently I only show enter spans. Maybe creating indents for each executed nested command is also not needed. Happy to hear feedback! Some further improvements could be to print step durations, if we decide to also log step exit events. We could also try to enable tracing in CI logs, but it might be too verbose. Best reviewed commit-by-commit. r? ``@jieyouxu`` CC ``@Shourya742``
I was annoyed that bootstrap had like 5 separate ways of debugging/tracing/profiling, and it was hard for me to understand how are individual steps executed. This PR tries to unify severla things behind
BOOTSTRAP_TRACING
, and improve tracing/profiling in general:latest
symlink to the latest generated tracing output directory for convenience.#[tracing::instrument]
).tracing_forest
was removed. While it did some useful postprocessing, it didn't expose enough information for making the dynamic step spans work.STEP=info
) and/or commands (COMMAND=info
), to have more granular control over what gets logged.print-step-timings
also show when a step starts its execution (not just when it ends it), so that when some step fails in CI, we can actually see what step it was (before we would only see the end of the previous step).There are still some things that work outside of tracing (
print-step-timings
anddump-bootstrap-shims
), but I think that for now this improvement is good enough.I removed the
> step
,< step
verbose output, because I found it unusable, as verbose bootstrap output also enables verbose Cargo output, and then you simply drown in too much data, and because I think that the new tracing system makes it obsolete (although it does require recompilation with thetracing
feature). If you want to keep it, happy to revert 690c781. And the information about cached steps is now also shown in the Graphviz step dependency graph.We can modify the tracing output however we want, as we now implement it ourselves. Notably, we could also show exit logs for step spans, currently I only show enter spans. Maybe creating indents for each executed nested command is also not needed. Happy to hear feedback!
Some further improvements could be to print step durations, if we decide to also log step exit events. We could also try to enable tracing in CI logs, but it might be too verbose.
Best reviewed commit-by-commit.
r? @jieyouxu
CC @Shourya742