From 2990d7afda6ebe6fa52b262b1b773b2580bc44e0 Mon Sep 17 00:00:00 2001 From: rami3l Date: Wed, 10 Jul 2024 10:23:45 +0800 Subject: [PATCH 1/3] ci(windows): increase stack size to 16MiB --- .github/workflows/ci.yaml | 3 +++ ci/actions-templates/windows-builds-template.yaml | 1 + 2 files changed, 4 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f342cf3240..6bd23baa45 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -24,6 +24,7 @@ jobs: if: ${{ contains('["pull_request", "merge_group"]', github.event_name) }} # skip-master skip-stable env: RUSTFLAGS: -Ctarget-feature=+crt-static + RUST_MIN_STACK: 16777216 permissions: id-token: write contents: read @@ -181,6 +182,7 @@ jobs: if: ${{ (github.event_name == 'push' && github.ref_name == 'master') || github.event_name == 'schedule' }} # skip-pr skip-stable env: RUSTFLAGS: -Ctarget-feature=+crt-static + RUST_MIN_STACK: 16777216 permissions: id-token: write contents: read @@ -338,6 +340,7 @@ jobs: if: ${{ github.event_name == 'push' && github.ref_name == 'stable' }} # skip-pr skip-master env: RUSTFLAGS: -Ctarget-feature=+crt-static + RUST_MIN_STACK: 16777216 permissions: id-token: write contents: read diff --git a/ci/actions-templates/windows-builds-template.yaml b/ci/actions-templates/windows-builds-template.yaml index 60cf4e5cf5..3256c1f895 100644 --- a/ci/actions-templates/windows-builds-template.yaml +++ b/ci/actions-templates/windows-builds-template.yaml @@ -11,6 +11,7 @@ jobs: # skip-master skip-pr skip-stable if: ${{ github.event_name == 'push' && github.ref_name == 'stable' }} # skip-pr skip-master env: RUSTFLAGS: -Ctarget-feature=+crt-static + RUST_MIN_STACK: 16777216 permissions: id-token: write contents: read From 2ede7f7414fc262aff521345fcb1e3dd8f68c8e9 Mon Sep 17 00:00:00 2001 From: rami3l Date: Wed, 10 Jul 2024 10:24:24 +0800 Subject: [PATCH 2/3] feat(log): unhide `tracing::instrument` from behind `feature = "otel"` --- doc/dev-guide/src/tracing.md | 2 +- src/bin/rustup-init.rs | 4 ++-- src/cli/common.rs | 2 +- src/cli/proxy_mode.rs | 2 +- src/cli/rustup_mode.rs | 8 ++++---- src/cli/self_update.rs | 2 +- src/cli/self_update/windows.rs | 2 +- src/cli/setup_mode.rs | 2 +- src/command.rs | 2 +- src/config.rs | 10 +++++----- src/dist/manifestation.rs | 2 +- src/dist/mod.rs | 2 +- src/install.rs | 2 +- src/test/mock/clitools.rs | 6 +++--- src/test/mock/dist.rs | 10 +++++----- src/toolchain.rs | 2 +- src/toolchain/distributable.rs | 12 ++++++------ 17 files changed, 36 insertions(+), 36 deletions(-) diff --git a/doc/dev-guide/src/tracing.md b/doc/dev-guide/src/tracing.md index 030e8b5c69..b8fdcd41ed 100644 --- a/doc/dev-guide/src/tracing.md +++ b/doc/dev-guide/src/tracing.md @@ -101,7 +101,7 @@ when enabled. Instrumenting a currently uninstrumented function is mostly simply done like so: ```rust -#[cfg_attr(feature = "otel", tracing::instrument(err, skip_all))] +#[tracing::instrument(level = "trace", err, skip_all)] ``` `skip_all` is not required, but some core structs don't implement Debug yet, and diff --git a/src/bin/rustup-init.rs b/src/bin/rustup-init.rs index c3c3426bfb..d32cb4a480 100644 --- a/src/bin/rustup-init.rs +++ b/src/bin/rustup-init.rs @@ -61,7 +61,7 @@ async fn main() -> Result { } } -#[cfg_attr(feature = "otel", tracing::instrument)] +#[tracing::instrument(level = "trace")] async fn run_rustup( process: &Process, console_filter: Handle, @@ -76,7 +76,7 @@ async fn run_rustup( result } -#[cfg_attr(feature = "otel", tracing::instrument(err))] +#[tracing::instrument(level = "trace", err)] async fn run_rustup_inner( process: &Process, console_filter: Handle, diff --git a/src/cli/common.rs b/src/cli/common.rs index 3e247f7082..ee107aad79 100644 --- a/src/cli/common.rs +++ b/src/cli/common.rs @@ -177,7 +177,7 @@ impl Notifier { } } -#[cfg_attr(feature = "otel", tracing::instrument)] +#[tracing::instrument(level = "trace")] pub(crate) fn set_globals( current_dir: PathBuf, verbose: bool, diff --git a/src/cli/proxy_mode.rs b/src/cli/proxy_mode.rs index 17a6b38bdd..2e4573bc3b 100644 --- a/src/cli/proxy_mode.rs +++ b/src/cli/proxy_mode.rs @@ -9,7 +9,7 @@ use crate::{ toolchain::ResolvableLocalToolchainName, }; -#[cfg_attr(feature = "otel", tracing::instrument)] +#[tracing::instrument(level = "trace")] pub async fn main(arg0: &str, current_dir: PathBuf, process: &Process) -> Result { self_update::cleanup_self_updater(process)?; diff --git a/src/cli/rustup_mode.rs b/src/cli/rustup_mode.rs index 1157f0b0c1..a5d5d17887 100644 --- a/src/cli/rustup_mode.rs +++ b/src/cli/rustup_mode.rs @@ -532,7 +532,7 @@ enum SetSubcmd { }, } -#[cfg_attr(feature = "otel", tracing::instrument(fields(args = format!("{:?}", process.args_os().collect::>()))))] +#[tracing::instrument(level = "trace", fields(args = format!("{:?}", process.args_os().collect::>())))] pub async fn main(current_dir: PathBuf, process: &Process) -> Result { self_update::cleanup_self_updater(process)?; @@ -907,7 +907,7 @@ async fn which( Ok(utils::ExitCode(0)) } -#[cfg_attr(feature = "otel", tracing::instrument(skip_all))] +#[tracing::instrument(level = "trace", skip_all)] fn show(cfg: &Cfg<'_>, verbose: bool) -> Result { common::warn_if_host_is_emulated(cfg.process); @@ -1048,7 +1048,7 @@ fn show(cfg: &Cfg<'_>, verbose: bool) -> Result { Ok(utils::ExitCode(0)) } -#[cfg_attr(feature = "otel", tracing::instrument(skip_all))] +#[tracing::instrument(level = "trace", skip_all)] fn show_active_toolchain(cfg: &Cfg<'_>, verbose: bool) -> Result { match cfg.find_active_toolchain()? { Some((toolchain_name, reason)) => { @@ -1075,7 +1075,7 @@ fn show_active_toolchain(cfg: &Cfg<'_>, verbose: bool) -> Result) -> Result { writeln!(cfg.process.stdout().lock(), "{}", cfg.rustup_dir.display())?; Ok(utils::ExitCode(0)) diff --git a/src/cli/self_update.rs b/src/cli/self_update.rs index 9607818359..1d9887a750 100644 --- a/src/cli/self_update.rs +++ b/src/cli/self_update.rs @@ -1237,7 +1237,7 @@ pub(crate) async fn check_rustup_update(process: &Process) -> Result<()> { Ok(()) } -#[cfg_attr(feature = "otel", tracing::instrument)] +#[tracing::instrument(level = "trace")] pub(crate) fn cleanup_self_updater(process: &Process) -> Result<()> { let cargo_home = process.cargo_home()?; let setup = cargo_home.join(format!("bin/rustup-init{EXE_SUFFIX}")); diff --git a/src/cli/self_update/windows.rs b/src/cli/self_update/windows.rs index cb062c5f92..faa84998ea 100644 --- a/src/cli/self_update/windows.rs +++ b/src/cli/self_update/windows.rs @@ -362,7 +362,7 @@ fn has_windows_sdk_libs(process: &Process) -> bool { } /// Run by rustup-gc-$num.exe to delete CARGO_HOME -#[cfg_attr(feature = "otel", tracing::instrument)] +#[tracing::instrument(level = "trace")] pub fn complete_windows_uninstall(process: &Process) -> Result { use std::process::Stdio; diff --git a/src/cli/setup_mode.rs b/src/cli/setup_mode.rs index 3911f7d59a..1c6a6d83ba 100644 --- a/src/cli/setup_mode.rs +++ b/src/cli/setup_mode.rs @@ -73,7 +73,7 @@ struct RustupInit { dump_testament: bool, } -#[cfg_attr(feature = "otel", tracing::instrument)] +#[tracing::instrument(level = "trace")] pub async fn main( current_dir: PathBuf, process: &Process, diff --git a/src/command.rs b/src/command.rs index 35dddd3dc8..c929fd0388 100644 --- a/src/command.rs +++ b/src/command.rs @@ -9,7 +9,7 @@ use anyhow::{Context, Result}; use crate::errors::*; -#[cfg_attr(feature = "otel", tracing::instrument(err))] +#[tracing::instrument(level = "trace", err)] pub(crate) fn run_command_for_dir + Debug>( mut cmd: Command, arg0: &str, diff --git a/src/config.rs b/src/config.rs index ec56c15a97..c728e1afa1 100644 --- a/src/config.rs +++ b/src/config.rs @@ -448,7 +448,7 @@ impl<'a> Cfg<'a> { Ok(self.update_hash_dir.join(toolchain.to_string())) } - #[cfg_attr(feature = "otel", tracing::instrument(skip_all))] + #[tracing::instrument(level = "trace", skip_all)] pub(crate) fn upgrade_data(&self) -> Result<()> { let current_version = self.settings_file.with(|s| Ok(s.version))?; if current_version == MetadataVersion::default() { @@ -693,7 +693,7 @@ impl<'a> Cfg<'a> { } } - #[cfg_attr(feature = "otel", tracing::instrument)] + #[tracing::instrument(level = "trace")] pub(crate) async fn active_rustc_version(&mut self) -> Result { if let Some(t) = self.process.args().find(|x| x.starts_with('+')) { trace!("Fetching rustc version from toolchain `{}`", t); @@ -734,7 +734,7 @@ impl<'a> Cfg<'a> { }) } - #[cfg_attr(feature = "otel", tracing::instrument(skip_all))] + #[tracing::instrument(level = "trace", skip_all)] async fn find_or_install_active_toolchain(&'a self) -> Result<(Toolchain<'a>, ActiveReason)> { match self.find_override_config()? { Some((override_config, reason)) => match override_config { @@ -839,7 +839,7 @@ impl<'a> Cfg<'a> { /// - not files /// - named with a valid resolved toolchain name /// Currently no notification of incorrect names or entry type is done. - #[cfg_attr(feature = "otel", tracing::instrument(skip_all))] + #[tracing::instrument(level = "trace", skip_all)] pub(crate) fn list_toolchains(&self) -> Result> { if utils::is_directory(&self.toolchains_dir) { let mut toolchains: Vec<_> = utils::read_dir("toolchains", &self.toolchains_dir)? @@ -921,7 +921,7 @@ impl<'a> Cfg<'a> { }) } - #[cfg_attr(feature = "otel", tracing::instrument(skip_all))] + #[tracing::instrument(level = "trace", skip_all)] pub(crate) fn get_default_host_triple(&self) -> Result { self.settings_file .with(|s| Ok(get_default_host_triple(s, self.process))) diff --git a/src/dist/manifestation.rs b/src/dist/manifestation.rs index 5e10cf39bc..a61349354b 100644 --- a/src/dist/manifestation.rs +++ b/src/dist/manifestation.rs @@ -401,7 +401,7 @@ impl Manifestation { } } - #[cfg_attr(feature = "otel", tracing::instrument)] + #[tracing::instrument(level = "trace")] pub fn load_manifest(&self) -> Result> { let prefix = self.installation.prefix(); let old_manifest_path = prefix.manifest_file(DIST_MANIFEST); diff --git a/src/dist/mod.rs b/src/dist/mod.rs index 031853a421..29d86325bc 100644 --- a/src/dist/mod.rs +++ b/src/dist/mod.rs @@ -823,7 +823,7 @@ pub(crate) struct DistOptions<'a> { // an upgrade then all the existing components will be upgraded. // // Returns the manifest's hash if anything changed. -#[cfg_attr(feature = "otel", tracing::instrument(err, skip_all, fields(profile=format!("{:?}", opts.profile), prefix=prefix.path().to_string_lossy().to_string())))] +#[tracing::instrument(level = "trace", err, skip_all, fields(profile=format!("{:?}", opts.profile), prefix=prefix.path().to_string_lossy().to_string()))] pub(crate) async fn update_from_dist( prefix: &InstallPrefix, opts: &DistOptions<'_>, diff --git a/src/install.rs b/src/install.rs index cb0cf2ee24..a424d00c6b 100644 --- a/src/install.rs +++ b/src/install.rs @@ -37,7 +37,7 @@ pub(crate) enum InstallMethod<'a> { impl<'a> InstallMethod<'a> { // Install a toolchain - #[cfg_attr(feature = "otel", tracing::instrument(err, skip_all))] + #[tracing::instrument(level = "trace", err, skip_all)] pub(crate) async fn install(&self) -> Result { let nh = &self.cfg().notify_handler; match self { diff --git a/src/test/mock/clitools.rs b/src/test/mock/clitools.rs index 3ce3232674..93ead6004d 100644 --- a/src/test/mock/clitools.rs +++ b/src/test/mock/clitools.rs @@ -769,7 +769,7 @@ impl Config { output } - #[cfg_attr(feature = "otel", tracing::instrument(skip_all))] + #[tracing::instrument(level = "trace", skip_all)] pub(crate) async fn run_inprocess( &self, name: &str, @@ -1059,7 +1059,7 @@ impl Release { } } - #[cfg_attr(feature = "otel", tracing::instrument(skip_all))] + #[tracing::instrument(level = "trace", skip_all)] fn link(&self, path: &Path) { // Also create the manifests for releases by version let _ = hard_link( @@ -1112,7 +1112,7 @@ impl Release { } // Creates a mock dist server populated with some test data -#[cfg_attr(feature = "otel", tracing::instrument(skip_all))] +#[tracing::instrument(level = "trace", skip_all)] fn create_mock_dist_server(path: &Path, s: Scenario) { let chans = match s { Scenario::None => return, diff --git a/src/test/mock/dist.rs b/src/test/mock/dist.rs index 679a865494..ec0a45c5b4 100644 --- a/src/test/mock/dist.rs +++ b/src/test/mock/dist.rs @@ -132,7 +132,7 @@ pub enum MockManifestVersion { } impl MockDistServer { - #[cfg_attr(feature = "otel", tracing::instrument(skip_all))] + #[tracing::instrument(level = "trace", skip_all)] pub fn write(&self, vs: &[MockManifestVersion], enable_xz: bool, enable_zst: bool) { fs::create_dir_all(&self.path).unwrap(); @@ -151,7 +151,7 @@ impl MockDistServer { } } - #[cfg_attr(feature = "otel", tracing::instrument(skip_all))] + #[tracing::instrument(level = "trace", skip_all)] fn build_package( &self, channel: &MockChannel, @@ -192,7 +192,7 @@ impl MockDistServer { } // Returns the hash of the tarball - #[cfg_attr(feature = "otel", tracing::instrument(skip_all, fields(format=%format)))] + #[tracing::instrument(level = "trace", skip_all, fields(format=%format))] fn build_target_package( &self, channel: &MockChannel, @@ -279,7 +279,7 @@ impl MockDistServer { } // The v1 manifest is just the directory listing of the rust tarballs - #[cfg_attr(feature = "otel", tracing::instrument(skip_all))] + #[tracing::instrument(level = "trace", skip_all)] fn write_manifest_v1(&self, channel: &MockChannel) { let mut buf = String::new(); let package = channel.packages.iter().find(|p| p.name == "rust").unwrap(); @@ -308,7 +308,7 @@ impl MockDistServer { hard_link(&hash_path, archive_hash_path).unwrap(); } - #[cfg_attr(feature = "otel", tracing::instrument(skip_all))] + #[tracing::instrument(level = "trace", skip_all)] fn write_manifest_v2( &self, channel: &MockChannel, diff --git a/src/toolchain.rs b/src/toolchain.rs index 6c995cba7c..21e19f62f1 100644 --- a/src/toolchain.rs +++ b/src/toolchain.rs @@ -253,7 +253,7 @@ impl<'a> Toolchain<'a> { } /// Infallible function that describes the version of rustc in an installed distribution - #[cfg_attr(feature = "otel", tracing::instrument)] + #[tracing::instrument(level = "trace")] pub fn rustc_version(&self) -> String { match self.create_command("rustc") { Ok(mut cmd) => { diff --git a/src/toolchain/distributable.rs b/src/toolchain/distributable.rs index 618bb67b71..2257b8408f 100644 --- a/src/toolchain/distributable.rs +++ b/src/toolchain/distributable.rs @@ -301,14 +301,14 @@ impl<'a> DistributableToolchain<'a> { } } - #[cfg_attr(feature = "otel", tracing::instrument(skip_all))] + #[tracing::instrument(level = "trace", skip_all)] pub(crate) fn get_manifestation(&self) -> anyhow::Result { let prefix = InstallPrefix::from(self.toolchain.path()); Manifestation::open(prefix, self.desc.target.clone()) } /// Get the manifest associated with this distribution - #[cfg_attr(feature = "otel", tracing::instrument(skip_all))] + #[tracing::instrument(level = "trace", skip_all)] pub(crate) fn get_manifest(&self) -> anyhow::Result { self.get_manifestation()? .load_manifest() @@ -324,7 +324,7 @@ impl<'a> DistributableToolchain<'a> { InstallPrefix::from(self.toolchain.path().to_owned()).guess_v1_manifest() } - #[cfg_attr(feature = "otel", tracing::instrument(err, skip_all))] + #[tracing::instrument(level = "trace", err, skip_all)] pub(crate) async fn install( cfg: &'a Cfg<'a>, toolchain: &ToolchainDesc, @@ -354,7 +354,7 @@ impl<'a> DistributableToolchain<'a> { Ok((status, Self::new(cfg, toolchain.clone())?)) } - #[cfg_attr(feature = "otel", tracing::instrument(err, skip_all))] + #[tracing::instrument(level = "trace", err, skip_all)] pub async fn install_if_not_installed( cfg: &'a Cfg<'a>, desc: &ToolchainDesc, @@ -372,7 +372,7 @@ impl<'a> DistributableToolchain<'a> { } } - #[cfg_attr(feature = "otel", tracing::instrument(err, skip_all))] + #[tracing::instrument(level = "trace", err, skip_all)] pub(crate) async fn update( &mut self, components: &[&str], @@ -384,7 +384,7 @@ impl<'a> DistributableToolchain<'a> { } /// Update a toolchain with control over the channel behaviour - #[cfg_attr(feature = "otel", tracing::instrument(err, skip_all))] + #[tracing::instrument(level = "trace", err, skip_all)] pub(crate) async fn update_extra( &mut self, components: &[&str], From c67848773933f9e87570badf3b3d88644d1bb285 Mon Sep 17 00:00:00 2001 From: rami3l Date: Wed, 10 Jul 2024 10:54:47 +0800 Subject: [PATCH 3/3] feat(log): set level of `#[tracing::instrument(err)]` to `TRACE` --- doc/dev-guide/src/tracing.md | 2 +- src/bin/rustup-init.rs | 2 +- src/command.rs | 2 +- src/dist/mod.rs | 2 +- src/install.rs | 2 +- src/toolchain/distributable.rs | 8 ++++---- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/doc/dev-guide/src/tracing.md b/doc/dev-guide/src/tracing.md index b8fdcd41ed..1161111d23 100644 --- a/doc/dev-guide/src/tracing.md +++ b/doc/dev-guide/src/tracing.md @@ -101,7 +101,7 @@ when enabled. Instrumenting a currently uninstrumented function is mostly simply done like so: ```rust -#[tracing::instrument(level = "trace", err, skip_all)] +#[tracing::instrument(level = "trace", err(level = "trace"), skip_all)] ``` `skip_all` is not required, but some core structs don't implement Debug yet, and diff --git a/src/bin/rustup-init.rs b/src/bin/rustup-init.rs index d32cb4a480..8c1af11d55 100644 --- a/src/bin/rustup-init.rs +++ b/src/bin/rustup-init.rs @@ -76,7 +76,7 @@ async fn run_rustup( result } -#[tracing::instrument(level = "trace", err)] +#[tracing::instrument(level = "trace", err(level = "trace"))] async fn run_rustup_inner( process: &Process, console_filter: Handle, diff --git a/src/command.rs b/src/command.rs index c929fd0388..a5f241e6a6 100644 --- a/src/command.rs +++ b/src/command.rs @@ -9,7 +9,7 @@ use anyhow::{Context, Result}; use crate::errors::*; -#[tracing::instrument(level = "trace", err)] +#[tracing::instrument(level = "trace", err(level = "trace"))] pub(crate) fn run_command_for_dir + Debug>( mut cmd: Command, arg0: &str, diff --git a/src/dist/mod.rs b/src/dist/mod.rs index 29d86325bc..e2abf2aeb3 100644 --- a/src/dist/mod.rs +++ b/src/dist/mod.rs @@ -823,7 +823,7 @@ pub(crate) struct DistOptions<'a> { // an upgrade then all the existing components will be upgraded. // // Returns the manifest's hash if anything changed. -#[tracing::instrument(level = "trace", err, skip_all, fields(profile=format!("{:?}", opts.profile), prefix=prefix.path().to_string_lossy().to_string()))] +#[tracing::instrument(level = "trace", err(level = "trace"), skip_all, fields(profile=format!("{:?}", opts.profile), prefix=prefix.path().to_string_lossy().to_string()))] pub(crate) async fn update_from_dist( prefix: &InstallPrefix, opts: &DistOptions<'_>, diff --git a/src/install.rs b/src/install.rs index a424d00c6b..97f1548ba7 100644 --- a/src/install.rs +++ b/src/install.rs @@ -37,7 +37,7 @@ pub(crate) enum InstallMethod<'a> { impl<'a> InstallMethod<'a> { // Install a toolchain - #[tracing::instrument(level = "trace", err, skip_all)] + #[tracing::instrument(level = "trace", err(level = "trace"), skip_all)] pub(crate) async fn install(&self) -> Result { let nh = &self.cfg().notify_handler; match self { diff --git a/src/toolchain/distributable.rs b/src/toolchain/distributable.rs index 2257b8408f..72cfb66aef 100644 --- a/src/toolchain/distributable.rs +++ b/src/toolchain/distributable.rs @@ -324,7 +324,7 @@ impl<'a> DistributableToolchain<'a> { InstallPrefix::from(self.toolchain.path().to_owned()).guess_v1_manifest() } - #[tracing::instrument(level = "trace", err, skip_all)] + #[tracing::instrument(level = "trace", err(level = "trace"), skip_all)] pub(crate) async fn install( cfg: &'a Cfg<'a>, toolchain: &ToolchainDesc, @@ -354,7 +354,7 @@ impl<'a> DistributableToolchain<'a> { Ok((status, Self::new(cfg, toolchain.clone())?)) } - #[tracing::instrument(level = "trace", err, skip_all)] + #[tracing::instrument(level = "trace", err(level = "trace"), skip_all)] pub async fn install_if_not_installed( cfg: &'a Cfg<'a>, desc: &ToolchainDesc, @@ -372,7 +372,7 @@ impl<'a> DistributableToolchain<'a> { } } - #[tracing::instrument(level = "trace", err, skip_all)] + #[tracing::instrument(level = "trace", err(level = "trace"), skip_all)] pub(crate) async fn update( &mut self, components: &[&str], @@ -384,7 +384,7 @@ impl<'a> DistributableToolchain<'a> { } /// Update a toolchain with control over the channel behaviour - #[tracing::instrument(level = "trace", err, skip_all)] + #[tracing::instrument(level = "trace", err(level = "trace"), skip_all)] pub(crate) async fn update_extra( &mut self, components: &[&str],