Skip to content

Commit

Permalink
Avoid logging to sucba if ratelim is passed & other fixes
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Clara Rull authored and facebook-github-bot committed Dec 12, 2024
1 parent 7a05197 commit df91c7f
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions eden/mononoke/edenapi_service/src/utils/rate_limit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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)
}
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit df91c7f

Please sign in to comment.