diff --git a/src/rust/engine/process_execution/src/remote_cache.rs b/src/rust/engine/process_execution/src/remote_cache.rs index 8782f1520aa..8162813bb6f 100644 --- a/src/rust/engine/process_execution/src/remote_cache.rs +++ b/src/rust/engine/process_execution/src/remote_cache.rs @@ -521,6 +521,7 @@ async fn check_action_cache( |workunit| async move { workunit.increment_counter(Metric::RemoteCacheRequests, 1); + let start = Instant::now(); let client = action_cache_client.as_ref().clone(); let response = retry_call( client, @@ -580,6 +581,11 @@ async fn check_action_cache( }) .await; + workunit.record_observation( + ObservationMetric::RemoteCacheGetActionResultTimeMicros, + start.elapsed().as_micros() as u64, + ); + match response { Ok(response) => { workunit.increment_counter(Metric::RemoteCacheRequestsCached, 1); diff --git a/src/rust/engine/workunit_store/src/metrics.rs b/src/rust/engine/workunit_store/src/metrics.rs index b29a7e43e20..eb5e7f7b25b 100644 --- a/src/rust/engine/workunit_store/src/metrics.rs +++ b/src/rust/engine/workunit_store/src/metrics.rs @@ -80,4 +80,6 @@ pub enum ObservationMetric { /// The time saved (in milliseconds) thanks to a remote cache hit instead of running the process /// directly. RemoteCacheTimeSavedMs, + /// Remote cache timing (in microseconds) for GetActionResult calls. + RemoteCacheGetActionResultTimeMicros, }