@@ -7,6 +7,7 @@ pub mod s3;
77pub ( crate ) mod sealed;
88
99use crate :: metrics:: { Operation , SegmentProcessMetrics , SegmentProcessMetricsGuard } ;
10+ use crate :: rate_limit:: rate_limited;
1011use metrique:: timers:: Timer ;
1112use metrique_writer:: BoxEntrySink ;
1213use pipeline_metrics:: { MetriqueResult , PipelineMetrics , StageMetrics } ;
@@ -80,11 +81,13 @@ impl BackgroundTaskConfig {
8081 match stem {
8182 Some ( s) if !s. is_empty ( ) => s,
8283 _ => {
83- tracing:: error!(
84- target: "dial9_worker" ,
85- path = %self . trace_path. display( ) ,
86- "trace_path has no file stem — pass a path like /tmp/traces/trace.bin, not a directory"
87- ) ;
84+ rate_limited ! ( Duration :: from_secs( 60 ) , {
85+ tracing:: error!(
86+ target: "dial9_worker" ,
87+ path = %self . trace_path. display( ) ,
88+ "trace_path has no file stem — pass a path like /tmp/traces/trace.bin, not a directory"
89+ ) ;
90+ } ) ;
8891 "trace"
8992 }
9093 }
@@ -378,7 +381,9 @@ impl SegmentProcessor for SymbolizeProcessor {
378381 Ok ( data)
379382 }
380383 Ok ( Err ( e) ) => {
381- tracing:: warn!( target: "dial9_worker" , error = %e, "symbolization failed, preserving original bytes" ) ;
384+ rate_limited ! ( Duration :: from_secs( 60 ) , {
385+ tracing:: warn!( target: "dial9_worker" , error = %e, "symbolization failed, preserving original bytes" ) ;
386+ } ) ;
382387 Err ( ProcessError {
383388 data,
384389 kind : ProcessErrorKind :: Io ( e) ,
@@ -434,10 +439,12 @@ impl SegmentProcessor for WriteBackProcessor {
434439 let _ = std:: fs:: remove_file ( & dest_path) ;
435440 }
436441 Err ( e) => {
437- tracing:: warn!(
438- "failed to remove original segment {}: {e}" ,
439- original_path. display( )
440- ) ;
442+ rate_limited ! ( Duration :: from_secs( 60 ) , {
443+ tracing:: warn!(
444+ "failed to remove original segment {}: {e}" ,
445+ original_path. display( )
446+ ) ;
447+ } ) ;
441448 }
442449 }
443450 }
@@ -512,7 +519,9 @@ impl WorkerLoop {
512519 let segments = match sealed:: find_sealed_segments ( & self . dir , & self . stem ) {
513520 Ok ( s) => s,
514521 Err ( e) => {
515- tracing:: warn!( target: "dial9_worker" , "failed to scan for sealed segments: {e}" ) ;
522+ rate_limited ! ( Duration :: from_secs( 60 ) , {
523+ tracing:: warn!( target: "dial9_worker" , "failed to scan for sealed segments: {e}" ) ;
524+ } ) ;
516525 return false ;
517526 }
518527 } ;
@@ -540,7 +549,9 @@ impl WorkerLoop {
540549 continue ;
541550 }
542551 Err ( e) => {
543- tracing:: warn!( target: "dial9_worker" , error = %e, "failed to read segment" ) ;
552+ rate_limited ! ( Duration :: from_secs( 60 ) , {
553+ tracing:: warn!( target: "dial9_worker" , error = %e, "failed to read segment" ) ;
554+ } ) ;
544555 continue ;
545556 }
546557 } ;
@@ -592,9 +603,13 @@ impl WorkerLoop {
592603 tracing:: debug!( target: "dial9_worker" , path = %segment. path. display( ) , "segment evicted during processing, skipping" ) ;
593604 } else {
594605 if let Err ( remove_err) = std:: fs:: remove_file ( & segment. path ) {
595- tracing:: warn!( target: "dial9_worker" , error = %remove_err, path = %segment. path. display( ) , "failed to remove corrupted segment" ) ;
606+ rate_limited ! ( Duration :: from_secs( 60 ) , {
607+ tracing:: warn!( target: "dial9_worker" , error = %remove_err, path = %segment. path. display( ) , "failed to remove corrupted segment" ) ;
608+ } ) ;
596609 }
597- tracing:: warn!( target: "dial9_worker" , error = %e. kind, cause = ?e. kind, path = %segment. path. display( ) , "processor failed, removing segment" ) ;
610+ rate_limited ! ( Duration :: from_secs( 60 ) , {
611+ tracing:: warn!( target: "dial9_worker" , error = %e. kind, cause = ?e. kind, path = %segment. path. display( ) , "processor failed, removing segment" ) ;
612+ } ) ;
598613 }
599614 continue ' next_segment;
600615 }
@@ -684,7 +699,9 @@ impl SegmentProcessor for S3PipelineUploader {
684699 {
685700 Ok ( key) => {
686701 self . circuit_breaker . on_success ( ) ;
687- tracing:: info!( target: "dial9_worker" , "uploaded {key}" ) ;
702+ rate_limited ! ( Duration :: from_secs( 10 ) , {
703+ tracing:: info!( target: "dial9_worker" , "uploaded {key}" ) ;
704+ } ) ;
688705 Ok ( data)
689706 }
690707 Err ( kind) => {
@@ -693,7 +710,9 @@ impl SegmentProcessor for S3PipelineUploader {
693710 tracing:: debug!( target: "dial9_worker" , path = %data. segment. path. display( ) , "segment already evicted, skipping" ) ;
694711 } else {
695712 self . circuit_breaker . on_failure ( ) ;
696- tracing:: warn!( target: "dial9_worker" , error = %kind, "upload failed" ) ;
713+ rate_limited ! ( Duration :: from_secs( 60 ) , {
714+ tracing:: warn!( target: "dial9_worker" , error = %kind, "upload failed" ) ;
715+ } ) ;
697716 }
698717 Err ( ProcessError { data, kind } )
699718 }
0 commit comments