Skip to content

Commit d2a4823

Browse files
devin-ai-integration[bot]Jayant Krishnamurthy
andcommitted
feat: implement request duration tracking in process_event_with_backoff
Co-Authored-By: Jayant Krishnamurthy <[email protected]>
1 parent 570510d commit d2a4823

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

apps/fortuna/src/keeper.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,8 @@ pub async fn process_event_with_backoff(
374374
gas_limit: U256,
375375
metrics: Arc<KeeperMetrics>,
376376
) {
377+
let start_time = std::time::Instant::now();
378+
377379
metrics
378380
.requests
379381
.get_or_create(&AccountLabel {
@@ -404,6 +406,16 @@ pub async fn process_event_with_backoff(
404406
tracing::error!("Failed to process event: {:?}", e);
405407
}
406408
}
409+
410+
let duration_ms = start_time.elapsed().as_millis() as f64;
411+
metrics
412+
.request_duration_ms
413+
.get_or_create(&AccountLabel {
414+
chain_id: chain_state.id.clone(),
415+
address: chain_state.provider_address.to_string(),
416+
})
417+
.observe(duration_ms);
418+
407419
metrics
408420
.requests_processed
409421
.get_or_create(&AccountLabel {

0 commit comments

Comments
 (0)