Skip to content

Commit

Permalink
[internal] add observation metric for REAPI GetActionResult calls (pa…
Browse files Browse the repository at this point in the history
…ntsbuild#15967)

Add an observation metric (histogram) for calls to Action Cache `GetActionResult` RPC. This will help with monitoring reads from remote cache.
# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
  • Loading branch information
Tom Dyas committed Jun 28, 2022
1 parent 228d83b commit cb46008
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/rust/engine/process_execution/src/remote_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions src/rust/engine/workunit_store/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}

0 comments on commit cb46008

Please sign in to comment.