Skip to content

Commit

Permalink
Cleanup: log SCS stats in a single place
Browse files Browse the repository at this point in the history
Summary: Very minor cleanup, but it will make it easier to understand what is going on.

Reviewed By: clara-9

Differential Revision: D68950883

fbshipit-source-id: 971bd0a2aa23adcfe93a9e32ed42e01b36a3d1ac
  • Loading branch information
andreacampi authored and facebook-github-bot committed Jan 31, 2025
1 parent bbbe702 commit 29a3487
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions eden/mononoke/scs/scs_methods/src/source_control_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,10 @@ fn log_result<T: AddScubaResponse>(
STATS::total_request_internal_failure_permille.add_value(internal_failure * 1000);
STATS::total_request_invalid_permille.add_value(invalid_request * 1000);
STATS::total_request_overloaded.add_value(overloaded);
STATS::method_completion_time_ms.add_value(
stats.completion_time.as_millis_unchecked() as i64,
(method.to_string(),),
);

ctx.perf_counters().insert_perf_counters(&mut scuba);

Expand Down Expand Up @@ -818,6 +822,11 @@ fn log_stream_complete(
STATS::total_request_internal_failure_permille.add_value(internal_failure * 1000);
STATS::total_request_invalid_permille.add_value(invalid_request * 1000);
STATS::total_request_overloaded.add_value(overloaded);
// Only accounts for the time to start the stream, not the overall time.
STATS::method_completion_time_ms.add_value(
initial_future_stats.completion_time.as_millis_unchecked() as i64,
(method.to_string(),),
);

ctx.perf_counters().insert_perf_counters(&mut scuba);

Expand Down Expand Up @@ -1001,8 +1010,6 @@ macro_rules! impl_thrift_methods {
.on_cancel_with_data(|stats| log_cancelled(&ctx, stringify!($method_name), &stats, start_mem_stats.as_ref()))
.await;
log_result(ctx, "Request complete", stringify!($method_name), &stats, &res, start_mem_stats.as_ref());
let method = stringify!($method_name).to_string();
STATS::method_completion_time_ms.add_value(stats.completion_time.as_millis_unchecked() as i64, (method,));
res.map_err(Into::into)
}
};
Expand Down Expand Up @@ -1061,8 +1068,6 @@ macro_rules! impl_thrift_stream_methods {
else {
log_result(ctx.clone(), "Request complete", stringify!($method_name), &stats, &res, start_mem_stats.as_ref());
}
let method = stringify!($method_name).to_string();
STATS::method_completion_time_ms.add_value(stats.completion_time.as_millis_unchecked() as i64, (method,));
let first_error = Arc::new(OnceLock::new());
let chunk_counter = AtomicU64::new(0);
res.map_err(Into::into).map(move |(res, stream)| {
Expand Down

0 comments on commit 29a3487

Please sign in to comment.