From df91c7f5687784c6fcf463a60fcbc9c44ae852ab Mon Sep 17 00:00:00 2001 From: Clara Rull Date: Thu, 12 Dec 2024 07:00:33 -0800 Subject: [PATCH] Avoid logging to sucba if ratelim is passed & other fixes Summary: This diff has 3 small fixes: - Avoiding logging to scuba if the ratelimit is passed, to reduce logging volume (https://fb.workplace.com/groups/1708850869939124/permalink/1855036085320601/) - Change TIME_WINDOW_MIN to the queried time window for accuracy: https://www.internalfb.com/code/fbsource/fbcode/ratelim/TimeWindowCounter.h?lines=76 - Change wording in logging Reviewed By: andreacampi Differential Revision: D67103037 fbshipit-source-id: 9716126e6222986401cd6684161d47ba16a13f62 --- eden/mononoke/edenapi_service/src/utils/rate_limit.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/eden/mononoke/edenapi_service/src/utils/rate_limit.rs b/eden/mononoke/edenapi_service/src/utils/rate_limit.rs index 02df2b882a9ef..f4c2499038105 100644 --- a/eden/mononoke/edenapi_service/src/utils/rate_limit.rs +++ b/eden/mononoke/edenapi_service/src/utils/rate_limit.rs @@ -19,7 +19,7 @@ use time_window_counter::BoxGlobalTimeWindowCounter; use time_window_counter::GlobalTimeWindowCounterBuilder; use tokio::time::timeout; -const TIME_WINDOW_MIN: u32 = 10; +const TIME_WINDOW_MIN: u32 = 1; const TIME_WINDOW_MAX: u32 = 3600; const RATELIM_FETCH_TIMEOUT: Duration = Duration::from_secs(1); @@ -32,7 +32,7 @@ pub fn build_counter( let key = make_key(rate_limit_name, identifier); debug!( ctx.logger(), - "Associating key {:?} with author {:?}", key, identifier + "Associating key {:?} with client_id {:?}", key, identifier ); GlobalTimeWindowCounterBuilder::build(ctx.fb, category, key, TIME_WINDOW_MIN, TIME_WINDOW_MAX) } @@ -71,8 +71,6 @@ pub async fn counter_check_and_bump<'a>( count, max_value, ); - let msg = format!("{}: Passed", rate_limit_name); - scuba.log_with_msg(&msg, None); counter.bump(1.0); Ok(()) } else if !enforced {