-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
bootstrap: Implement conditional tracing
infra
#135391
Conversation
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. |
tracing
infratracing
infra
"regex-automata", | ||
"regex-syntax", | ||
"regex-automata 0.4.9", | ||
"regex-syntax 0.8.5", |
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.
Seems like we duplicated few dependencies. Is it possible to avoid this?
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.
Possibly, I may have used tracing*
versions that are too new. I'll double check.
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 one is duplicated because
├── tracing-subscriber v0.3.19
│ ├── matchers v0.1.0
│ │ └── regex-automata v0.1.10
│ │ └── regex-syntax v0.6.29
I don't think this can be dedup'd because it's a transitive dep of tracing-subscriber
when env-filter
feature is enabled (which is used to filter like BOOTSTRAP_TRACING=bootstrap::core::build_steps::test=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.
tracing
stuck with updating matchers
almost half year :-(
And with nu-ansi-term
too.
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.
Want to cargo have ability to simply apply patches to dependencies, like [patch]
but with diff files.
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.
Oh hey... Chris opened a PR for nu-ansi-term
at tokio-rs/tracing#3049 and the matchers
bump is stuck on maintainer bandwidth probably at tokio-rs/tracing#3033
@rustbot author |
768f397
to
d3a6460
Compare
@rustbot ready |
src/doc/rustc-dev-guide/src/building/bootstrapping/debugging-bootstrap.md
Outdated
Show resolved
Hide resolved
d3a6460
to
b9f9976
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.
Remark: this output is from next doors over at #135299.
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.
Feel free to r=me with the nit
src/doc/rustc-dev-guide/src/building/bootstrapping/debugging-bootstrap.md
Outdated
Show resolved
Hide resolved
b9f9976
to
3ae724e
Compare
@bors r+ |
Rollup of 3 pull requests Successful merges: - rust-lang#135355 (ci: added test log format for ci) - rust-lang#135386 (clean up code related to the rustdoc-js test suite) - rust-lang#135391 (bootstrap: Implement conditional `tracing` infra) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#135391 - jieyouxu:conditional-tracing, r=onur-ozkan bootstrap: Implement conditional `tracing` infra Add a conditional `tracing` setup that is gated behind `BOOTSTRAP_TRACING` env var. This `tracing` infra is implemented by: - Introducing an optional `tracing` cargo feature in bootstrap. - Added optional `tracing*` dependencies which are gated behind the `tracing` cargo feature. - When `BOOTSTRAP_TRACING` is set, `bootstrap.py` will build bootstrap with `--features=tracing`. There is a small trick here to share `BOOTSTRAP_TRACING` env var without having to add a separate env var: - `BOOTSTRAP_TRACING=1` is not a registered `tracing` filter target, so that can be used to enable the `tracing` cargo feature yet not actually enable any tracing logs (useful for editor r-a setups without actually outputting any tracing logs). - `BOOTSTRAP_TRACING=TRACE` and such are actually valid `tracing` filters, but that sets `BOOTSTRAP_TRACING` anyway. Example usage: rust-lang#135299 (that experimental PR is not conditionally gated) This PR is intentionally kept minimal to focus on the infra itself. To get actual mileage, instrumentations will need to be added to individual `Step`s and such. r? `@onur-ozkan` (or reroll)
…rrors bootstrap: fix outdated feature name in comment Follow-up to rust-lang#135391 (comment). I guess I updated everything else **except** the comment right next to the actual dependencies 💀 r? bootstrap
…rrors bootstrap: fix outdated feature name in comment Follow-up to rust-lang#135391 (comment). I guess I updated everything else **except** the comment right next to the actual dependencies 💀 r? bootstrap
Rollup merge of rust-lang#135452 - jieyouxu:fix-comment, r=compiler-errors bootstrap: fix outdated feature name in comment Follow-up to rust-lang#135391 (comment). I guess I updated everything else **except** the comment right next to the actual dependencies 💀 r? bootstrap
"--json-output", | ||
"--build-dir=build-rust-analyzer" | ||
], | ||
``` |
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.
On the latest master branch, BOOSTRACING=1
has no effect.
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 is my current ra setup:
{
"git.detectSubmodulesLimit": 20,
"rust-analyzer.check.invocationStrategy": "once",
"rust-analyzer.check.overrideCommand": [
"BOOTSTRAP_TRACING=1",
"python",
"x.py",
"check",
// "compiler",
"src/bootstrap",
"--build-dir=build-rust-analyzer",
"--json-output"
],
"rust-analyzer.linkedProjects": [
"Cargo.toml",
"library/Cargo.toml",
// "src/tools/x/Cargo.toml",
"src/bootstrap/Cargo.toml",
// "src/tools/rust-analyzer/Cargo.toml",
// "compiler/rustc_codegen_cranelift/Cargo.toml",
// "compiler/rustc_codegen_gcc/Cargo.toml"
],
"rust-analyzer.rustfmt.overrideCommand": [
"${workspaceFolder}/build-rust-analyzer/host/rustfmt/bin/rustfmt",
"--edition=2021"
],
"rust-analyzer.procMacro.server": "${workspaceFolder}/build-rust-analyzer/host/stage0/libexec/rust-analyzer-proc-macro-srv",
"rust-analyzer.procMacro.enable": true,
"rust-analyzer.cargo.buildScripts.enable": true,
"rust-analyzer.cargo.buildScripts.invocationStrategy": "once",
"rust-analyzer.cargo.buildScripts.overrideCommand": [
"BOOTSTRAP_TRACING=1",
"python",
"x.py",
"check",
// "compiler",
"src/bootstrap",
"--build-dir=build-rust-analyzer",
"--json-output"
],
"rust-analyzer.cargo.sysrootSrc": "./library",
"rust-analyzer.rustc.source": "./Cargo.toml",
"rust-analyzer.cargo.extraEnv": {
"RUSTC_BOOTSTRAP": "1",
},
"rust-analyzer.server.extraEnv": {
"RUSTUP_TOOLCHAIN": "nightly"
},
"python.analysis.exclude": [
"**"
]
}
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 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.
Additionally, I observed that the ra output:
2025-01-18T19:47:55.3706583+08:00 ERROR FetchBuildDataError: Failed to run build scripts for C:\Users\xxxx\source\rust-compiler: program not found
Failed to run build scripts for C:\Users\xxxx\source\rust-compiler\library: program not found
Failed to run build scripts for C:\Users\xxxx\source\rust-compiler\src\bootstrap: program not found
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.
On the latest master branch,
BOOSTRACING=1
has no effect.
see PR description
This PR is intentionally kept minimal to focus on the infra itself. To get actual mileage, instrumentations will need to be added to individual Steps and such.
Add some tracing to core bootstrap logic Follow-up to rust-lang#135391. ### Summary Add some initial tracing logging to bootstrap, focused on the core logic (in this PR). Also: - Adjusted tracing-tree style to not use indent lines (I found that more distracting than helpful). - Avoid glob-importing `tracing` items. - Improve the rustc-dev-guide docs on bootstrap tracing. ### Example output ```bash $ BOOTSTRAP_TRACING=bootstrap=TRACE ./x check src/bootstrap ```  r? bootstrap
Add some tracing to core bootstrap logic Follow-up to rust-lang#135391. ### Summary Add some initial tracing logging to bootstrap, focused on the core logic (in this PR). Also: - Adjusted tracing-tree style to not use indent lines (I found that more distracting than helpful). - Avoid glob-importing `tracing` items. - Improve the rustc-dev-guide docs on bootstrap tracing. ### Example output ```bash $ BOOTSTRAP_TRACING=bootstrap=TRACE ./x check src/bootstrap ```  r? bootstrap
Rollup merge of rust-lang#136091 - jieyouxu:core-tracing, r=clubby789 Add some tracing to core bootstrap logic Follow-up to rust-lang#135391. ### Summary Add some initial tracing logging to bootstrap, focused on the core logic (in this PR). Also: - Adjusted tracing-tree style to not use indent lines (I found that more distracting than helpful). - Avoid glob-importing `tracing` items. - Improve the rustc-dev-guide docs on bootstrap tracing. ### Example output ```bash $ BOOTSTRAP_TRACING=bootstrap=TRACE ./x check src/bootstrap ```  r? bootstrap
Add a conditional
tracing
setup that is gated behindBOOTSTRAP_TRACING
env var. Thistracing
infra is implemented by:tracing
cargo feature in bootstrap.tracing*
dependencies which are gated behind thetracing
cargo feature.BOOTSTRAP_TRACING
is set,bootstrap.py
will build bootstrap with--features=tracing
.There is a small trick here to share
BOOTSTRAP_TRACING
env var without having to add a separate env var:BOOTSTRAP_TRACING=1
is not a registeredtracing
filter target, so that can be used to enable thetracing
cargo feature yet not actually enable any tracing logs (useful for editor r-a setups without actually outputting any tracing logs).BOOTSTRAP_TRACING=TRACE
and such are actually validtracing
filters, but that setsBOOTSTRAP_TRACING
anyway.Example usage: #135299 (that experimental PR is not conditionally gated)
This PR is intentionally kept minimal to focus on the infra itself. To get actual mileage, instrumentations will need to be added to individual
Step
s and such.r? @onur-ozkan (or reroll)