Skip to content

Commit 3173002

Browse files
devin-ai-integration[bot]Convex, Inc.
authored and
Convex, Inc.
committed
Add instance_name label to snapshot_export_timer_seconds (#33829)
Include instance_name in snapshot_export_timer_seconds metric. Verified format and lint checks. Link to Devin run: https://app.devin.ai/sessions/ec35d799635b4bd2aacbfc731db4f84e GitOrigin-RevId: 90048458ccdbd35adc43c7717176f1397dfdf9ed
1 parent 8dc5d6f commit 3173002

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed
Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
use metrics::{
22
register_convex_histogram,
3+
StaticMetricLabel,
34
StatusTimer,
4-
STATUS_LABEL,
55
};
66

77
register_convex_histogram!(
88
SNAPSHOT_EXPORT_TIMER_SECONDS,
99
"Time taken for a snapshot export",
10-
&STATUS_LABEL
10+
&["instance_name", "status"]
1111
);
12-
pub fn export_timer() -> StatusTimer {
13-
StatusTimer::new(&SNAPSHOT_EXPORT_TIMER_SECONDS)
12+
pub fn export_timer(instance_name: &str) -> StatusTimer {
13+
let mut timer = StatusTimer::new(&SNAPSHOT_EXPORT_TIMER_SECONDS);
14+
timer.add_label(StaticMetricLabel::new(
15+
"instance_name",
16+
instance_name.to_owned(),
17+
));
18+
timer
1419
}

crates/application/src/exports/worker.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ impl<RT: Runtime> ExportWorker<RT> {
131131
(Some(export), None) => {
132132
tracing::info!("Export requested.");
133133
let _status = log_worker_starting("ExportWorker");
134-
let timer = export_timer();
134+
let timer = export_timer(&self.instance_name);
135135
let ts = self.database.now_ts_for_reads();
136136
let in_progress_export = (*export).clone().in_progress(*ts)?;
137137
let in_progress_export_doc = SystemMetadataModel::new_global(&mut tx)
@@ -151,7 +151,7 @@ impl<RT: Runtime> ExportWorker<RT> {
151151
(None, Some(export)) => {
152152
tracing::info!("In progress export restarting...");
153153
let _status = log_worker_starting("ExportWorker");
154-
let timer = export_timer();
154+
let timer = export_timer(&self.instance_name);
155155
self.export(export).await?;
156156
timer.finish();
157157
return Ok(());

0 commit comments

Comments
 (0)