Skip to content

Commit 1b7662e

Browse files
committed
Revert 1 commits
0cf0c6b 'feat(log): unhide `tracing::instrument` from behind `feature = "otel"`'
1 parent 0cf0c6b commit 1b7662e

File tree

18 files changed

+38
-37
lines changed

18 files changed

+38
-37
lines changed

doc/dev-guide/src/tracing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ when enabled. Instrumenting a currently uninstrumented function is mostly simply
5252
done like so:
5353

5454
```rust
55-
#[tracing::instrument(level = "trace", err, skip_all)]
55+
#[cfg_attr(feature = "otel", tracing::instrument(err, skip_all))]
5656
```
5757

5858
`skip_all` is not required, but some core structs don't implement Debug yet, and

rustup-macros/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ fn test_inner(mod_path: String, mut input: ItemFn) -> syn::Result<TokenStream> {
9898
#before_ident().await;
9999
// Define a function with same name we can instrument inside the
100100
// tracing enablement logic.
101-
#[tracing::instrument(level = "trace", skip_all)]
101+
#[cfg_attr(feature = "otel", tracing::instrument(skip_all))]
102102
async fn #name() { #inner }
103103
// Thunk through a new thread to permit catching the panic
104104
// without grabbing the entire state machine defined by the

src/bin/rustup-init.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ async fn maybe_trace_rustup() -> Result<utils::ExitCode> {
6767
result
6868
}
6969

70-
#[tracing::instrument(level = "trace")]
70+
// FIXME: Make `tracing::instrument` always run
71+
#[cfg_attr(feature = "otel", tracing::instrument)]
7172
async fn run_rustup() -> Result<utils::ExitCode> {
7273
if let Ok(dir) = process().var("RUSTUP_TRACE_DIR") {
7374
open_trace_file!(dir)?;
@@ -79,7 +80,7 @@ async fn run_rustup() -> Result<utils::ExitCode> {
7980
result
8081
}
8182

82-
#[tracing::instrument(level = "trace", err)]
83+
#[cfg_attr(feature = "otel", tracing::instrument(err))]
8384
async fn run_rustup_inner() -> Result<utils::ExitCode> {
8485
// Guard against infinite proxy recursion. This mostly happens due to
8586
// bugs in rustup.

src/cli/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ impl Notifier {
179179
}
180180
}
181181

182-
#[tracing::instrument(level = "trace")]
182+
#[cfg_attr(feature = "otel", tracing::instrument)]
183183
pub(crate) fn set_globals(current_dir: PathBuf, verbose: bool, quiet: bool) -> Result<Cfg> {
184184
let notifier = Notifier::new(verbose, quiet);
185185
Cfg::from_env(current_dir, Arc::new(move |n| notifier.handle(n)))

src/cli/proxy_mode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use crate::{
1010
toolchain::names::ResolvableLocalToolchainName,
1111
};
1212

13-
#[tracing::instrument(level = "trace")]
13+
#[cfg_attr(feature = "otel", tracing::instrument)]
1414
pub async fn main(arg0: &str, current_dir: PathBuf) -> Result<ExitStatus> {
1515
self_update::cleanup_self_updater()?;
1616

src/cli/rustup_mode.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ enum SetSubcmd {
535535
},
536536
}
537537

538-
#[tracing::instrument(level = "trace", fields(args = format!("{:?}", process().args_os().collect::<Vec<_>>())))]
538+
#[cfg_attr(feature = "otel", tracing::instrument(fields(args = format!("{:?}", process().args_os().collect::<Vec<_>>()))))]
539539
pub async fn main(current_dir: PathBuf) -> Result<utils::ExitCode> {
540540
self_update::cleanup_self_updater()?;
541541

@@ -550,7 +550,7 @@ pub async fn main(current_dir: PathBuf) -> Result<utils::ExitCode> {
550550
write!(process().stdout().lock(), "{err}")?;
551551
info!("This is the version for the rustup toolchain manager, not the rustc compiler.");
552552

553-
#[tracing::instrument(level = "trace")]
553+
#[cfg_attr(feature = "otel", tracing::instrument)]
554554
async fn rustc_version(
555555
current_dir: PathBuf,
556556
) -> std::result::Result<String, Box<dyn std::error::Error>> {
@@ -938,7 +938,7 @@ async fn which(
938938
Ok(utils::ExitCode(0))
939939
}
940940

941-
#[tracing::instrument(level = "trace", skip_all)]
941+
#[cfg_attr(feature = "otel", tracing::instrument(skip_all))]
942942
fn show(cfg: &Cfg, verbose: bool) -> Result<utils::ExitCode> {
943943
common::warn_if_host_is_emulated();
944944

@@ -1075,7 +1075,7 @@ fn show(cfg: &Cfg, verbose: bool) -> Result<utils::ExitCode> {
10751075
Ok(utils::ExitCode(0))
10761076
}
10771077

1078-
#[tracing::instrument(level = "trace", skip_all)]
1078+
#[cfg_attr(feature = "otel", tracing::instrument(skip_all))]
10791079
fn show_active_toolchain(cfg: &Cfg, verbose: bool) -> Result<utils::ExitCode> {
10801080
match cfg.find_active_toolchain()? {
10811081
Some((toolchain_name, reason)) => {
@@ -1099,7 +1099,7 @@ fn show_active_toolchain(cfg: &Cfg, verbose: bool) -> Result<utils::ExitCode> {
10991099
Ok(utils::ExitCode(0))
11001100
}
11011101

1102-
#[tracing::instrument(level = "trace", skip_all)]
1102+
#[cfg_attr(feature = "otel", tracing::instrument(skip_all))]
11031103
fn show_rustup_home(cfg: &Cfg) -> Result<utils::ExitCode> {
11041104
writeln!(process().stdout().lock(), "{}", cfg.rustup_dir.display())?;
11051105
Ok(utils::ExitCode(0))

src/cli/self_update.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1321,7 +1321,7 @@ pub(crate) async fn check_rustup_update() -> Result<()> {
13211321
Ok(())
13221322
}
13231323

1324-
#[tracing::instrument(level = "trace")]
1324+
#[cfg_attr(feature = "otel", tracing::instrument)]
13251325
pub(crate) fn cleanup_self_updater() -> Result<()> {
13261326
let cargo_home = utils::cargo_home()?;
13271327
let setup = cargo_home.join(format!("bin/rustup-init{EXE_SUFFIX}"));

src/cli/self_update/windows.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ fn has_windows_sdk_libs() -> bool {
264264
}
265265

266266
/// Run by rustup-gc-$num.exe to delete CARGO_HOME
267-
#[tracing::instrument(level = "trace")]
267+
#[cfg_attr(feature = "otel", tracing::instrument)]
268268
pub fn complete_windows_uninstall() -> Result<utils::ExitCode> {
269269
use std::process::Stdio;
270270

src/cli/setup_mode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ struct RustupInit {
7575
dump_testament: bool,
7676
}
7777

78-
#[tracing::instrument(level = "trace")]
78+
#[cfg_attr(feature = "otel", tracing::instrument)]
7979
pub async fn main(current_dir: PathBuf) -> Result<utils::ExitCode> {
8080
use clap::error::ErrorKind;
8181

src/command.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use anyhow::{Context, Result};
99

1010
use crate::errors::*;
1111

12-
#[tracing::instrument(level = "trace", err)]
12+
#[cfg_attr(feature = "otel", tracing::instrument(err))]
1313
pub(crate) fn run_command_for_dir<S: AsRef<OsStr> + Debug>(
1414
mut cmd: Command,
1515
arg0: &str,

0 commit comments

Comments
 (0)