@@ -402,60 +402,61 @@ impl TracingConfiguration {
402402 #[ cfg( feature = "sentry" ) ]
403403 {
404404 // Prepare the Sentry layer, if a DSN is provided.
405- let ( sentry_layer, sentry_logging_ctx) = if let Some ( sentry_dsn) = self . sentry_dsn . take ( ) {
406- // Initialize the Sentry client with the given options.
407- let sentry_guard = sentry:: init ( (
408- sentry_dsn,
409- sentry:: ClientOptions {
410- traces_sample_rate : 0.0 ,
411- attach_stacktrace : true ,
412- release : Some ( env ! ( "VERGEN_GIT_SHA" ) . into ( ) ) ,
413- ..sentry:: ClientOptions :: default ( )
414- } ,
415- ) ) ;
416-
417- let sentry_enabled = Arc :: new ( AtomicBool :: new ( true ) ) ;
418-
419- // Add a Sentry layer to the tracing subscriber.
420- //
421- // Pass custom event and span filters, which will ignore anything, if the Sentry
422- // support has been globally disabled, or if the statement doesn't include a
423- // `sentry` field set to `true`.
424- let sentry_layer = sentry_tracing:: layer ( )
425- . event_filter ( {
426- let enabled = sentry_enabled. clone ( ) ;
427-
428- move |metadata| {
429- if enabled. load ( std:: sync:: atomic:: Ordering :: SeqCst )
430- && metadata. fields ( ) . field ( "sentry" ) . is_some ( )
431- {
432- sentry_tracing:: default_event_filter ( metadata)
433- } else {
434- // Ignore the event.
435- sentry_tracing:: EventFilter :: Ignore
405+ let ( sentry_layer, sentry_logging_ctx) =
406+ if let Some ( sentry_dsn) = self . sentry_dsn . take ( ) {
407+ // Initialize the Sentry client with the given options.
408+ let sentry_guard = sentry:: init ( (
409+ sentry_dsn,
410+ sentry:: ClientOptions {
411+ traces_sample_rate : 0.0 ,
412+ attach_stacktrace : true ,
413+ release : Some ( env ! ( "VERGEN_GIT_SHA" ) . into ( ) ) ,
414+ ..sentry:: ClientOptions :: default ( )
415+ } ,
416+ ) ) ;
417+
418+ let sentry_enabled = Arc :: new ( AtomicBool :: new ( true ) ) ;
419+
420+ // Add a Sentry layer to the tracing subscriber.
421+ //
422+ // Pass custom event and span filters, which will ignore anything, if the Sentry
423+ // support has been globally disabled, or if the statement doesn't include a
424+ // `sentry` field set to `true`.
425+ let sentry_layer = sentry_tracing:: layer ( )
426+ . event_filter ( {
427+ let enabled = sentry_enabled. clone ( ) ;
428+
429+ move |metadata| {
430+ if enabled. load ( std:: sync:: atomic:: Ordering :: SeqCst )
431+ && metadata. fields ( ) . field ( "sentry" ) . is_some ( )
432+ {
433+ sentry_tracing:: default_event_filter ( metadata)
434+ } else {
435+ // Ignore the event.
436+ sentry_tracing:: EventFilter :: Ignore
437+ }
436438 }
437- }
438- } )
439- . span_filter ( {
440- let enabled = sentry_enabled . clone ( ) ;
441-
442- move |metadata| {
443- if enabled . load ( std :: sync :: atomic :: Ordering :: SeqCst ) {
444- sentry_tracing :: default_span_filter ( metadata )
445- } else {
446- // Ignore, if sentry is globally disabled.
447- false
439+ } )
440+ . span_filter ( {
441+ let enabled = sentry_enabled . clone ( ) ;
442+
443+ move |metadata| {
444+ if enabled . load ( std :: sync :: atomic :: Ordering :: SeqCst ) {
445+ sentry_tracing :: default_span_filter ( metadata )
446+ } else {
447+ // Ignore, if sentry is globally disabled.
448+ false
449+ }
448450 }
449- }
450- } ) ;
451-
452- (
453- Some ( sentry_layer) ,
454- Some ( SentryLoggingCtx { _guard : sentry_guard, enabled : sentry_enabled } ) ,
455- )
456- } else {
457- ( None , None )
458- } ;
451+ } ) ;
452+
453+ (
454+ Some ( sentry_layer) ,
455+ Some ( SentryLoggingCtx { _guard : sentry_guard, enabled : sentry_enabled } ) ,
456+ )
457+ } else {
458+ ( None , None )
459+ } ;
459460 tracing_subscriber:: registry ( )
460461 . with ( tracing_subscriber:: EnvFilter :: new ( & env_filter) )
461462 . with ( crate :: platform:: text_layers ( self ) )
0 commit comments