@@ -12,6 +12,7 @@ use backon::{ExponentialBuilder, Retryable};
1212use futures:: TryFutureExt ;
1313use thiserror:: Error ;
1414use tokio:: time:: { error as TokioError , timeout} ;
15+ #[ cfg( feature = "tracing" ) ]
1516use tracing:: instrument;
1617
1718use crate :: robust_provider:: RobustSubscription ;
@@ -322,7 +323,7 @@ impl<N: Network> RobustProvider<N> {
322323 . await
323324 }
324325
325- #[ instrument( level = "trace" , skip( self , operation, last_error) ) ]
326+ #[ cfg_attr ( feature = "tracing" , instrument( level = "trace" , skip( self , operation, last_error) ) ) ]
326327 pub ( crate ) async fn try_fallback_providers < T : Debug , F , Fut > (
327328 & self ,
328329 operation : F ,
@@ -338,7 +339,7 @@ impl<N: Network> RobustProvider<N> {
338339 . map ( |( value, _idx) | value)
339340 }
340341
341- #[ instrument( level = "trace" , skip( self , operation, last_error) ) ]
342+ #[ cfg_attr ( feature = "tracing" , instrument( level = "trace" , skip( self , operation, last_error) ) ) ]
342343 pub ( crate ) async fn try_fallback_providers_from < T : Debug , F , Fut > (
343344 & self ,
344345 operation : F ,
@@ -362,7 +363,7 @@ impl<N: Network> RobustProvider<N> {
362363 continue ;
363364 }
364365
365- tracing :: trace!(
366+ trace ! (
366367 fallback_provider_index = fallback_idx + 1 ,
367368 total_num_fallbacks = num_fallbacks,
368369 "Attempting fallback provider"
@@ -384,7 +385,7 @@ impl<N: Network> RobustProvider<N> {
384385 }
385386 }
386387
387- tracing:: error!( "All providers exhausted " ) ;
388+ tracing:: error!( "All providers failed " ) ;
388389
389390 Err ( last_error)
390391 }
0 commit comments