File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
crates/application/src/snapshot_import Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change 1
1
use std:: time:: Duration ;
2
2
3
3
use metrics:: {
4
+ log_counter,
4
5
log_distribution,
6
+ register_convex_counter,
5
7
register_convex_histogram,
6
8
StatusTimer ,
7
9
STATUS_LABEL ,
@@ -23,3 +25,11 @@ register_convex_histogram!(
23
25
pub fn log_snapshot_import_age ( age : Duration ) {
24
26
log_distribution ( & SNAPSHOT_IMPORT_AGE_SECONDS , age. as_secs_f64 ( ) ) ;
25
27
}
28
+
29
+ register_convex_counter ! (
30
+ SNAPSHOT_IMPORT_WORKER_DIED_TOTAL ,
31
+ "Number of times the snapshot import worker died" ,
32
+ ) ;
33
+ pub fn log_snapshot_import_worker_died ( ) {
34
+ log_counter ( & SNAPSHOT_IMPORT_WORKER_DIED_TOTAL , 1 ) ;
35
+ }
Original file line number Diff line number Diff line change @@ -22,7 +22,10 @@ use usage_tracking::UsageCounter;
22
22
use crate :: {
23
23
metrics:: log_worker_starting,
24
24
snapshot_import:: {
25
- metrics:: snapshot_import_timer,
25
+ metrics:: {
26
+ log_snapshot_import_worker_died,
27
+ snapshot_import_timer,
28
+ } ,
26
29
SnapshotImportExecutor ,
27
30
} ,
28
31
} ;
@@ -51,6 +54,7 @@ impl SnapshotImportWorker {
51
54
async move {
52
55
loop {
53
56
if let Err ( e) = Self :: run_once ( & mut worker) . await {
57
+ log_snapshot_import_worker_died ( ) ;
54
58
report_error ( & mut e. context ( "SnapshotImportWorker died" ) ) . await ;
55
59
let delay = worker. backoff . fail ( & mut worker. runtime . rng ( ) ) ;
56
60
worker. runtime . wait ( delay) . await ;
You can’t perform that action at this time.
0 commit comments