Skip to content
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

Add some tracing to core bootstrap logic #136091

Merged
merged 5 commits into from
Jan 27, 2025
Merged

Conversation

jieyouxu
Copy link
Member

@jieyouxu jieyouxu commented Jan 26, 2025

Follow-up to #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

$ BOOTSTRAP_TRACING=bootstrap=TRACE ./x check src/bootstrap

Example bootstrap tracing output

r? bootstrap

@rustbot rustbot added A-rustc-dev-guide Area: rustc-dev-guide S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Jan 26, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jan 26, 2025

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.

cc @BoxyUwU, @jieyouxu, @Kobzol

This PR modifies src/bootstrap/src/core/config.

If appropriate, please update CONFIG_CHANGE_HISTORY in src/bootstrap/src/utils/change_tracker.rs.

@jieyouxu jieyouxu added the A-bootstrap-tracing Area: bootstrap tracing label Jan 26, 2025
@clubby789
Copy link
Contributor

Looks like helpful improvements, r=me with nit

@jieyouxu
Copy link
Member Author

Removed the extra comma
@bors r=@clubby789 rollup

@bors
Copy link
Contributor

bors commented Jan 26, 2025

📌 Commit 97efda6 has been approved by clubby789

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 26, 2025
jhpratt added a commit to jhpratt/rust that referenced this pull request Jan 27, 2025
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
```

![Example bootstrap tracing output](https://github.com/user-attachments/assets/0be39042-0822-44b6-9451-30427cfea156)

r? bootstrap
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 27, 2025
Rollup of 5 pull requests

Successful merges:

 - rust-lang#135807 (Implement phantom variance markers)
 - rust-lang#136091 (Add some tracing to core bootstrap logic)
 - rust-lang#136094 (Upgrade elsa to the newest version.)
 - rust-lang#136097 (rustc_ast: replace some len-checks + indexing with slice patterns etc.)
 - rust-lang#136101 (triagebot: set myself on vacation)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 27, 2025
Rollup of 8 pull requests

Successful merges:

 - rust-lang#126604 (Uplift `clippy::double_neg` lint as `double_negations`)
 - rust-lang#135158 (Add `TooGeneric` variant to `LayoutError` and emit `Unknown`)
 - rust-lang#135635 (Move `std::io::pipe` code into its own file)
 - rust-lang#136072 (add two old crash tests)
 - rust-lang#136079 (compiler_fence: fix example)
 - rust-lang#136091 (Add some tracing to core bootstrap logic)
 - rust-lang#136097 (rustc_ast: replace some len-checks + indexing with slice patterns etc.)
 - rust-lang#136101 (triagebot: set myself on vacation)

r? `@ghost`
`@rustbot` modify labels: rollup
Comment on lines +32 to +33
#[cfg(feature = "tracing")]
debug!("parsing flags");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would simplify this by creating a logging wrapper macro (tracing_debug?) gated from tracing feature, which doesn't do anything on #[cfg(not(feature = "tracing")]) and uses debug macro on #[cfg(feature = "tracing")], so you don't need to add this conditional checks everywhere.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I forgor you could just forward via $($tokens:tt)*. I'll send a follow-up.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up: #136392

@bors bors merged commit e72e49a into rust-lang:master Jan 27, 2025
6 checks passed
@rustbot rustbot added this to the 1.86.0 milestone Jan 27, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Jan 27, 2025
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
```

![Example bootstrap tracing output](https://github.com/user-attachments/assets/0be39042-0822-44b6-9451-30427cfea156)

r? bootstrap
@jieyouxu jieyouxu deleted the core-tracing branch January 27, 2025 11:26
@fmease
Copy link
Member

fmease commented Feb 2, 2025

@bors r- ('fixing' desync)

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Feb 2, 2025
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 3, 2025
bootstrap: add wrapper macros for `feature = "tracing"`-gated `tracing` macros

Follow-up to rust-lang#136091 (comment).

- Add wrapper macros for `error!`, `warn!`, `info!`, `debug!` and `trace!`, which `cfg(feature = "tracing")`-gates the underlying `tracing` macros. They expand to nothing if `"tracing"` feature is not enabled.
- This is not done for `span!` or `event!` because they can return span guards, and you can't really wrap that.
- This is also not possible for `tracing::instrument` attribute proc-macro unless you use another attribute proc-macro to wrap that.

It's not *great*, because `tracing::instrument` and `tracing::{span,event}` can't be wrapped this way.

Can test locally with:

```bash
$ BOOTSTRAP_TRACING=bootstrap=TRACE ./x check src/bootstrap/
```

r? `@onur-ozkan` (or reroll)
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 3, 2025
bootstrap: add wrapper macros for `feature = "tracing"`-gated `tracing` macros

Follow-up to rust-lang#136091 (comment).

- Add wrapper macros for `error!`, `warn!`, `info!`, `debug!` and `trace!`, which `cfg(feature = "tracing")`-gates the underlying `tracing` macros. They expand to nothing if `"tracing"` feature is not enabled.
- This is not done for `span!` or `event!` because they can return span guards, and you can't really wrap that.
- This is also not possible for `tracing::instrument` attribute proc-macro unless you use another attribute proc-macro to wrap that.

It's not *great*, because `tracing::instrument` and `tracing::{span,event}` can't be wrapped this way.

Can test locally with:

```bash
$ BOOTSTRAP_TRACING=bootstrap=TRACE ./x check src/bootstrap/
```

r? ``@onur-ozkan`` (or reroll)
jieyouxu added a commit to jieyouxu/rust that referenced this pull request Feb 3, 2025
bootstrap: add wrapper macros for `feature = "tracing"`-gated `tracing` macros

Follow-up to rust-lang#136091 (comment).

- Add wrapper macros for `error!`, `warn!`, `info!`, `debug!` and `trace!`, which `cfg(feature = "tracing")`-gates the underlying `tracing` macros. They expand to nothing if `"tracing"` feature is not enabled.
- This is not done for `span!` or `event!` because they can return span guards, and you can't really wrap that.
- This is also not possible for `tracing::instrument` attribute proc-macro unless you use another attribute proc-macro to wrap that.

It's not *great*, because `tracing::instrument` and `tracing::{span,event}` can't be wrapped this way.

Can test locally with:

```bash
$ BOOTSTRAP_TRACING=bootstrap=TRACE ./x check src/bootstrap/
```

r? ```@onur-ozkan``` (or reroll)
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 3, 2025
bootstrap: add wrapper macros for `feature = "tracing"`-gated `tracing` macros

Follow-up to rust-lang#136091 (comment).

- Add wrapper macros for `error!`, `warn!`, `info!`, `debug!` and `trace!`, which `cfg(feature = "tracing")`-gates the underlying `tracing` macros. They expand to nothing if `"tracing"` feature is not enabled.
- This is not done for `span!` or `event!` because they can return span guards, and you can't really wrap that.
- This is also not possible for `tracing::instrument` attribute proc-macro unless you use another attribute proc-macro to wrap that.

It's not *great*, because `tracing::instrument` and `tracing::{span,event}` can't be wrapped this way.

Can test locally with:

```bash
$ BOOTSTRAP_TRACING=bootstrap=TRACE ./x check src/bootstrap/
```

r? ````@onur-ozkan```` (or reroll)
jhpratt added a commit to jhpratt/rust that referenced this pull request Feb 4, 2025
bootstrap: add wrapper macros for `feature = "tracing"`-gated `tracing` macros

Follow-up to rust-lang#136091 (comment).

- Add wrapper macros for `error!`, `warn!`, `info!`, `debug!` and `trace!`, which `cfg(feature = "tracing")`-gates the underlying `tracing` macros. They expand to nothing if `"tracing"` feature is not enabled.
- This is not done for `span!` or `event!` because they can return span guards, and you can't really wrap that.
- This is also not possible for `tracing::instrument` attribute proc-macro unless you use another attribute proc-macro to wrap that.

It's not *great*, because `tracing::instrument` and `tracing::{span,event}` can't be wrapped this way.

Can test locally with:

```bash
$ BOOTSTRAP_TRACING=bootstrap=TRACE ./x check src/bootstrap/
```

r? `@onur-ozkan` (or reroll)
fmease added a commit to fmease/rust that referenced this pull request Feb 5, 2025
bootstrap: add wrapper macros for `feature = "tracing"`-gated `tracing` macros

Follow-up to rust-lang#136091 (comment).

- Add wrapper macros for `error!`, `warn!`, `info!`, `debug!` and `trace!`, which `cfg(feature = "tracing")`-gates the underlying `tracing` macros. They expand to nothing if `"tracing"` feature is not enabled.
- This is not done for `span!` or `event!` because they can return span guards, and you can't really wrap that.
- This is also not possible for `tracing::instrument` attribute proc-macro unless you use another attribute proc-macro to wrap that.

It's not *great*, because `tracing::instrument` and `tracing::{span,event}` can't be wrapped this way.

Can test locally with:

```bash
$ BOOTSTRAP_TRACING=bootstrap=TRACE ./x check src/bootstrap/
```

r? ``@onur-ozkan`` (or reroll)
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Feb 5, 2025
Rollup merge of rust-lang#136392 - jieyouxu:wrap-tracing, r=onur-ozkan

bootstrap: add wrapper macros for `feature = "tracing"`-gated `tracing` macros

Follow-up to rust-lang#136091 (comment).

- Add wrapper macros for `error!`, `warn!`, `info!`, `debug!` and `trace!`, which `cfg(feature = "tracing")`-gates the underlying `tracing` macros. They expand to nothing if `"tracing"` feature is not enabled.
- This is not done for `span!` or `event!` because they can return span guards, and you can't really wrap that.
- This is also not possible for `tracing::instrument` attribute proc-macro unless you use another attribute proc-macro to wrap that.

It's not *great*, because `tracing::instrument` and `tracing::{span,event}` can't be wrapped this way.

Can test locally with:

```bash
$ BOOTSTRAP_TRACING=bootstrap=TRACE ./x check src/bootstrap/
```

r? ``@onur-ozkan`` (or reroll)
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Feb 6, 2025
bootstrap: add wrapper macros for `feature = "tracing"`-gated `tracing` macros

Follow-up to rust-lang/rust#136091 (comment).

- Add wrapper macros for `error!`, `warn!`, `info!`, `debug!` and `trace!`, which `cfg(feature = "tracing")`-gates the underlying `tracing` macros. They expand to nothing if `"tracing"` feature is not enabled.
- This is not done for `span!` or `event!` because they can return span guards, and you can't really wrap that.
- This is also not possible for `tracing::instrument` attribute proc-macro unless you use another attribute proc-macro to wrap that.

It's not *great*, because `tracing::instrument` and `tracing::{span,event}` can't be wrapped this way.

Can test locally with:

```bash
$ BOOTSTRAP_TRACING=bootstrap=TRACE ./x check src/bootstrap/
```

r? ``@onur-ozkan`` (or reroll)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-bootstrap-tracing Area: bootstrap tracing A-rustc-dev-guide Area: rustc-dev-guide S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants