diff --git a/src/test.rs b/src/test.rs index 7b21d89e9d4..007284d6cf4 100644 --- a/src/test.rs +++ b/src/test.rs @@ -239,16 +239,13 @@ type Tracer = (); /// A tracer for the tests. pub(crate) static TRACER: Lazy = Lazy::new(|| { - use tracing_subscriber::Registry; - #[cfg(feature = "otel")] { - use crate::cli::log::{telemetry, telemetry_default_tracer}; + use crate::cli::log::telemetry_default_tracer; use opentelemetry::global; use opentelemetry_sdk::propagation::TraceContextPropagator; use tokio::runtime::Handle; - use tracing_subscriber::layer::SubscriberExt as _; // Use the current runtime, or the sync test runtime otherwise. let handle = match Handle::try_current() { @@ -259,16 +256,7 @@ pub(crate) static TRACER: Lazy = Lazy::new(|| { let _guard = handle.enter(); global::set_text_map_propagator(TraceContextPropagator::new()); - let tracer = telemetry_default_tracer().unwrap(); - let telemetry = telemetry(tracer.clone()); - let subscriber = Registry::default().with(telemetry); - tracing::subscriber::set_global_default(subscriber).unwrap(); - tracer - } - #[cfg(not(feature = "otel"))] - { - let subscriber = Registry::default(); - tracing::subscriber::set_global_default(subscriber).unwrap(); + telemetry_default_tracer().unwrap() } });