Skip to content

Commit bd57b2b

Browse files
nipunn1313Convex, Inc.
authored andcommitted
Log snapshot import worker dying (#39074)
GitOrigin-RevId: 8de8e08f96c82fbb2e7861d139d079bbbc2657f6
1 parent 50bc28e commit bd57b2b

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

crates/application/src/snapshot_import/metrics.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
use std::time::Duration;
22

33
use metrics::{
4+
log_counter,
45
log_distribution,
6+
register_convex_counter,
57
register_convex_histogram,
68
StatusTimer,
79
STATUS_LABEL,
@@ -23,3 +25,11 @@ register_convex_histogram!(
2325
pub fn log_snapshot_import_age(age: Duration) {
2426
log_distribution(&SNAPSHOT_IMPORT_AGE_SECONDS, age.as_secs_f64());
2527
}
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+
}

crates/application/src/snapshot_import/worker.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ use usage_tracking::UsageCounter;
2222
use crate::{
2323
metrics::log_worker_starting,
2424
snapshot_import::{
25-
metrics::snapshot_import_timer,
25+
metrics::{
26+
log_snapshot_import_worker_died,
27+
snapshot_import_timer,
28+
},
2629
SnapshotImportExecutor,
2730
},
2831
};
@@ -51,6 +54,7 @@ impl SnapshotImportWorker {
5154
async move {
5255
loop {
5356
if let Err(e) = Self::run_once(&mut worker).await {
57+
log_snapshot_import_worker_died();
5458
report_error(&mut e.context("SnapshotImportWorker died")).await;
5559
let delay = worker.backoff.fail(&mut worker.runtime.rng());
5660
worker.runtime.wait(delay).await;

0 commit comments

Comments
 (0)