Skip to content

Commit 8730a22

Browse files
committed
feat(log): unhide tracing::instrument from behind feature = "otel"
1 parent f3ab93f commit 8730a22

17 files changed

+36
-36
lines changed

doc/dev-guide/src/tracing.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ when enabled. Instrumenting a currently uninstrumented function is mostly simply
101101
done like so:
102102

103103
```rust
104-
#[cfg_attr(feature = "otel", tracing::instrument(err, skip_all))]
104+
#[tracing::instrument(level = "trace", err, skip_all)]
105105
```
106106

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

src/bin/rustup-init.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ async fn main() -> Result<ExitCode> {
6161
}
6262
}
6363

64-
#[cfg_attr(feature = "otel", tracing::instrument)]
64+
#[tracing::instrument(level = "trace")]
6565
async fn run_rustup(
6666
process: &Process,
6767
console_filter: Handle<EnvFilter, Registry>,
@@ -76,7 +76,7 @@ async fn run_rustup(
7676
result
7777
}
7878

79-
#[cfg_attr(feature = "otel", tracing::instrument(err))]
79+
#[tracing::instrument(level = "trace", err)]
8080
async fn run_rustup_inner(
8181
process: &Process,
8282
console_filter: Handle<EnvFilter, Registry>,

src/cli/common.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ impl Notifier {
177177
}
178178
}
179179

180-
#[cfg_attr(feature = "otel", tracing::instrument)]
180+
#[tracing::instrument(level = "trace")]
181181
pub(crate) fn set_globals(
182182
current_dir: PathBuf,
183183
verbose: bool,

src/cli/proxy_mode.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use crate::{
99
toolchain::ResolvableLocalToolchainName,
1010
};
1111

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

src/cli/rustup_mode.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ enum SetSubcmd {
532532
},
533533
}
534534

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

@@ -907,7 +907,7 @@ async fn which(
907907
Ok(utils::ExitCode(0))
908908
}
909909

910-
#[cfg_attr(feature = "otel", tracing::instrument(skip_all))]
910+
#[tracing::instrument(level = "trace", skip_all)]
911911
fn show(cfg: &Cfg<'_>, verbose: bool) -> Result<utils::ExitCode> {
912912
common::warn_if_host_is_emulated(cfg.process);
913913

@@ -1048,7 +1048,7 @@ fn show(cfg: &Cfg<'_>, verbose: bool) -> Result<utils::ExitCode> {
10481048
Ok(utils::ExitCode(0))
10491049
}
10501050

1051-
#[cfg_attr(feature = "otel", tracing::instrument(skip_all))]
1051+
#[tracing::instrument(level = "trace", skip_all)]
10521052
fn show_active_toolchain(cfg: &Cfg<'_>, verbose: bool) -> Result<utils::ExitCode> {
10531053
match cfg.find_active_toolchain()? {
10541054
Some((toolchain_name, reason)) => {
@@ -1075,7 +1075,7 @@ fn show_active_toolchain(cfg: &Cfg<'_>, verbose: bool) -> Result<utils::ExitCode
10751075
Ok(utils::ExitCode(0))
10761076
}
10771077

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

src/cli/self_update.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1237,7 +1237,7 @@ pub(crate) async fn check_rustup_update(process: &Process) -> Result<()> {
12371237
Ok(())
12381238
}
12391239

1240-
#[cfg_attr(feature = "otel", tracing::instrument)]
1240+
#[tracing::instrument(level = "trace")]
12411241
pub(crate) fn cleanup_self_updater(process: &Process) -> Result<()> {
12421242
let cargo_home = process.cargo_home()?;
12431243
let setup = cargo_home.join(format!("bin/rustup-init{EXE_SUFFIX}"));

src/cli/self_update/windows.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ fn has_windows_sdk_libs(process: &Process) -> bool {
362362
}
363363

364364
/// Run by rustup-gc-$num.exe to delete CARGO_HOME
365-
#[cfg_attr(feature = "otel", tracing::instrument)]
365+
#[tracing::instrument(level = "trace")]
366366
pub fn complete_windows_uninstall(process: &Process) -> Result<utils::ExitCode> {
367367
use std::process::Stdio;
368368

src/cli/setup_mode.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ struct RustupInit {
7373
dump_testament: bool,
7474
}
7575

76-
#[cfg_attr(feature = "otel", tracing::instrument)]
76+
#[tracing::instrument(level = "trace")]
7777
pub async fn main(
7878
current_dir: PathBuf,
7979
process: &Process,

src/command.rs

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

1010
use crate::errors::*;
1111

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

src/config.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ impl<'a> Cfg<'a> {
448448
Ok(self.update_hash_dir.join(toolchain.to_string()))
449449
}
450450

451-
#[cfg_attr(feature = "otel", tracing::instrument(skip_all))]
451+
#[tracing::instrument(level = "trace", skip_all)]
452452
pub(crate) fn upgrade_data(&self) -> Result<()> {
453453
let current_version = self.settings_file.with(|s| Ok(s.version))?;
454454
if current_version == MetadataVersion::default() {
@@ -693,7 +693,7 @@ impl<'a> Cfg<'a> {
693693
}
694694
}
695695

696-
#[cfg_attr(feature = "otel", tracing::instrument)]
696+
#[tracing::instrument(level = "trace")]
697697
pub(crate) async fn active_rustc_version(&mut self) -> Result<String> {
698698
if let Some(t) = self.process.args().find(|x| x.starts_with('+')) {
699699
trace!("Fetching rustc version from toolchain `{}`", t);
@@ -734,7 +734,7 @@ impl<'a> Cfg<'a> {
734734
})
735735
}
736736

737-
#[cfg_attr(feature = "otel", tracing::instrument(skip_all))]
737+
#[tracing::instrument(level = "trace", skip_all)]
738738
async fn find_or_install_active_toolchain(&'a self) -> Result<(Toolchain<'a>, ActiveReason)> {
739739
match self.find_override_config()? {
740740
Some((override_config, reason)) => match override_config {
@@ -839,7 +839,7 @@ impl<'a> Cfg<'a> {
839839
/// - not files
840840
/// - named with a valid resolved toolchain name
841841
/// Currently no notification of incorrect names or entry type is done.
842-
#[cfg_attr(feature = "otel", tracing::instrument(skip_all))]
842+
#[tracing::instrument(level = "trace", skip_all)]
843843
pub(crate) fn list_toolchains(&self) -> Result<Vec<ToolchainName>> {
844844
if utils::is_directory(&self.toolchains_dir) {
845845
let mut toolchains: Vec<_> = utils::read_dir("toolchains", &self.toolchains_dir)?
@@ -921,7 +921,7 @@ impl<'a> Cfg<'a> {
921921
})
922922
}
923923

924-
#[cfg_attr(feature = "otel", tracing::instrument(skip_all))]
924+
#[tracing::instrument(level = "trace", skip_all)]
925925
pub(crate) fn get_default_host_triple(&self) -> Result<dist::TargetTriple> {
926926
self.settings_file
927927
.with(|s| Ok(get_default_host_triple(s, self.process)))

src/dist/manifestation.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ impl Manifestation {
401401
}
402402
}
403403

404-
#[cfg_attr(feature = "otel", tracing::instrument)]
404+
#[tracing::instrument(level = "trace")]
405405
pub fn load_manifest(&self) -> Result<Option<Manifest>> {
406406
let prefix = self.installation.prefix();
407407
let old_manifest_path = prefix.manifest_file(DIST_MANIFEST);

src/dist/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,7 @@ pub(crate) struct DistOptions<'a> {
823823
// an upgrade then all the existing components will be upgraded.
824824
//
825825
// Returns the manifest's hash if anything changed.
826-
#[cfg_attr(feature = "otel", tracing::instrument(err, skip_all, fields(profile=format!("{:?}", opts.profile), prefix=prefix.path().to_string_lossy().to_string())))]
826+
#[tracing::instrument(level = "trace", err, skip_all, fields(profile=format!("{:?}", opts.profile), prefix=prefix.path().to_string_lossy().to_string()))]
827827
pub(crate) async fn update_from_dist(
828828
prefix: &InstallPrefix,
829829
opts: &DistOptions<'_>,

src/install.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pub(crate) enum InstallMethod<'a> {
3737

3838
impl<'a> InstallMethod<'a> {
3939
// Install a toolchain
40-
#[cfg_attr(feature = "otel", tracing::instrument(err, skip_all))]
40+
#[tracing::instrument(level = "trace", err, skip_all)]
4141
pub(crate) async fn install(&self) -> Result<UpdateStatus> {
4242
let nh = &self.cfg().notify_handler;
4343
match self {

src/test/mock/clitools.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,7 @@ impl Config {
769769
output
770770
}
771771

772-
#[cfg_attr(feature = "otel", tracing::instrument(skip_all))]
772+
#[tracing::instrument(level = "trace", skip_all)]
773773
pub(crate) async fn run_inprocess<I, A>(
774774
&self,
775775
name: &str,
@@ -1059,7 +1059,7 @@ impl Release {
10591059
}
10601060
}
10611061

1062-
#[cfg_attr(feature = "otel", tracing::instrument(skip_all))]
1062+
#[tracing::instrument(level = "trace", skip_all)]
10631063
fn link(&self, path: &Path) {
10641064
// Also create the manifests for releases by version
10651065
let _ = hard_link(
@@ -1112,7 +1112,7 @@ impl Release {
11121112
}
11131113

11141114
// Creates a mock dist server populated with some test data
1115-
#[cfg_attr(feature = "otel", tracing::instrument(skip_all))]
1115+
#[tracing::instrument(level = "trace", skip_all)]
11161116
fn create_mock_dist_server(path: &Path, s: Scenario) {
11171117
let chans = match s {
11181118
Scenario::None => return,

src/test/mock/dist.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ pub enum MockManifestVersion {
132132
}
133133

134134
impl MockDistServer {
135-
#[cfg_attr(feature = "otel", tracing::instrument(skip_all))]
135+
#[tracing::instrument(level = "trace", skip_all)]
136136
pub fn write(&self, vs: &[MockManifestVersion], enable_xz: bool, enable_zst: bool) {
137137
fs::create_dir_all(&self.path).unwrap();
138138

@@ -151,7 +151,7 @@ impl MockDistServer {
151151
}
152152
}
153153

154-
#[cfg_attr(feature = "otel", tracing::instrument(skip_all))]
154+
#[tracing::instrument(level = "trace", skip_all)]
155155
fn build_package(
156156
&self,
157157
channel: &MockChannel,
@@ -192,7 +192,7 @@ impl MockDistServer {
192192
}
193193

194194
// Returns the hash of the tarball
195-
#[cfg_attr(feature = "otel", tracing::instrument(skip_all, fields(format=%format)))]
195+
#[tracing::instrument(level = "trace", skip_all, fields(format=%format))]
196196
fn build_target_package(
197197
&self,
198198
channel: &MockChannel,
@@ -279,7 +279,7 @@ impl MockDistServer {
279279
}
280280

281281
// The v1 manifest is just the directory listing of the rust tarballs
282-
#[cfg_attr(feature = "otel", tracing::instrument(skip_all))]
282+
#[tracing::instrument(level = "trace", skip_all)]
283283
fn write_manifest_v1(&self, channel: &MockChannel) {
284284
let mut buf = String::new();
285285
let package = channel.packages.iter().find(|p| p.name == "rust").unwrap();
@@ -308,7 +308,7 @@ impl MockDistServer {
308308
hard_link(&hash_path, archive_hash_path).unwrap();
309309
}
310310

311-
#[cfg_attr(feature = "otel", tracing::instrument(skip_all))]
311+
#[tracing::instrument(level = "trace", skip_all)]
312312
fn write_manifest_v2(
313313
&self,
314314
channel: &MockChannel,

src/toolchain.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ impl<'a> Toolchain<'a> {
253253
}
254254

255255
/// Infallible function that describes the version of rustc in an installed distribution
256-
#[cfg_attr(feature = "otel", tracing::instrument)]
256+
#[tracing::instrument(level = "trace")]
257257
pub fn rustc_version(&self) -> String {
258258
match self.create_command("rustc") {
259259
Ok(mut cmd) => {

src/toolchain/distributable.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -301,14 +301,14 @@ impl<'a> DistributableToolchain<'a> {
301301
}
302302
}
303303

304-
#[cfg_attr(feature = "otel", tracing::instrument(skip_all))]
304+
#[tracing::instrument(level = "trace", skip_all)]
305305
pub(crate) fn get_manifestation(&self) -> anyhow::Result<Manifestation> {
306306
let prefix = InstallPrefix::from(self.toolchain.path());
307307
Manifestation::open(prefix, self.desc.target.clone())
308308
}
309309

310310
/// Get the manifest associated with this distribution
311-
#[cfg_attr(feature = "otel", tracing::instrument(skip_all))]
311+
#[tracing::instrument(level = "trace", skip_all)]
312312
pub(crate) fn get_manifest(&self) -> anyhow::Result<Manifest> {
313313
self.get_manifestation()?
314314
.load_manifest()
@@ -324,7 +324,7 @@ impl<'a> DistributableToolchain<'a> {
324324
InstallPrefix::from(self.toolchain.path().to_owned()).guess_v1_manifest()
325325
}
326326

327-
#[cfg_attr(feature = "otel", tracing::instrument(err, skip_all))]
327+
#[tracing::instrument(level = "trace", err, skip_all)]
328328
pub(crate) async fn install(
329329
cfg: &'a Cfg<'a>,
330330
toolchain: &ToolchainDesc,
@@ -354,7 +354,7 @@ impl<'a> DistributableToolchain<'a> {
354354
Ok((status, Self::new(cfg, toolchain.clone())?))
355355
}
356356

357-
#[cfg_attr(feature = "otel", tracing::instrument(err, skip_all))]
357+
#[tracing::instrument(level = "trace", err, skip_all)]
358358
pub async fn install_if_not_installed(
359359
cfg: &'a Cfg<'a>,
360360
desc: &ToolchainDesc,
@@ -372,7 +372,7 @@ impl<'a> DistributableToolchain<'a> {
372372
}
373373
}
374374

375-
#[cfg_attr(feature = "otel", tracing::instrument(err, skip_all))]
375+
#[tracing::instrument(level = "trace", err, skip_all)]
376376
pub(crate) async fn update(
377377
&mut self,
378378
components: &[&str],
@@ -384,7 +384,7 @@ impl<'a> DistributableToolchain<'a> {
384384
}
385385

386386
/// Update a toolchain with control over the channel behaviour
387-
#[cfg_attr(feature = "otel", tracing::instrument(err, skip_all))]
387+
#[tracing::instrument(level = "trace", err, skip_all)]
388388
pub(crate) async fn update_extra(
389389
&mut self,
390390
components: &[&str],

0 commit comments

Comments
 (0)