diff --git a/rustup-macros/src/lib.rs b/rustup-macros/src/lib.rs index 70048983cd3..1dfe6800c8b 100644 --- a/rustup-macros/src/lib.rs +++ b/rustup-macros/src/lib.rs @@ -95,7 +95,7 @@ fn test_inner(mod_path: String, mut input: ItemFn) -> syn::Result { let name = input.sig.ident.clone(); let new_block: Block = parse_quote! { { - let _guard = #before_ident().await; + #before_ident().await; // Define a function with same name we can instrument inside the // tracing enablement logic. #[cfg_attr(feature = "otel", tracing::instrument(skip_all))] @@ -118,7 +118,6 @@ fn test_inner(mod_path: String, mut input: ItemFn) -> syn::Result { input.block = Box::new(new_block); Ok(quote! { - #[cfg_attr(feature = "otel", tracing::instrument(skip_all))] #[::tokio::test(flavor = "multi_thread", worker_threads = 1)] #input }) diff --git a/src/test.rs b/src/test.rs index a7a35719e80..2fbd47d9726 100644 --- a/src/test.rs +++ b/src/test.rs @@ -224,25 +224,12 @@ where f(&rustup_home) } -pub async fn before_test_async() -> Option { +pub async fn before_test_async() { #[cfg(feature = "otel")] { - use tracing_subscriber::{layer::SubscriberExt, Registry}; - - let telemetry = { - use opentelemetry::global; - use opentelemetry_sdk::propagation::TraceContextPropagator; - - global::set_text_map_propagator(TraceContextPropagator::new()); - crate::cli::log::telemetry() - }; - - let subscriber = Registry::default().with(telemetry); - Some(tracing::subscriber::set_default(subscriber)) - } - #[cfg(not(feature = "otel"))] - { - None + opentelemetry::global::set_text_map_propagator( + opentelemetry_sdk::propagation::TraceContextPropagator::new(), + ); } }