File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -547,7 +547,8 @@ impl Logger {
547
547
METRICS . logger . missed_log_count . inc ( ) ;
548
548
}
549
549
} else {
550
- panic ! ( "Failed to write to the provided metrics destination due to poisoned lock" ) ;
550
+ METRICS . logger . missed_log_count . inc ( ) ;
551
+ panic ! ( "Failed to write to the provided log destination due to poisoned lock" ) ;
551
552
}
552
553
} else if msg_level <= Level :: Warn {
553
554
eprintln ! ( "{}" , msg) ;
@@ -566,13 +567,15 @@ impl Logger {
566
567
match serde_json:: to_string ( METRICS . deref ( ) ) {
567
568
Ok ( msg) => {
568
569
if let Some ( guard) = self . metrics_buf_guard ( ) . as_mut ( ) {
569
- write_to_destination ( msg, guard)
570
+ return write_to_destination ( msg, guard)
570
571
. map_err ( |e| {
571
572
METRICS . logger . missed_metrics_count . inc ( ) ;
572
573
e
573
574
} )
574
- . map ( |( ) | true ) ? ;
575
+ . map ( |_ | true ) ;
575
576
} else {
577
+ // We have not incremented `missed_metrics_count` as there is no way to push metrics
578
+ // if destination lock got poisoned.
576
579
panic ! ( "Failed to write to the provided metrics destination due to poisoned lock" ) ;
577
580
}
578
581
}
You can’t perform that action at this time.
0 commit comments