Skip to content

Commit 0033dfd

Browse files
Clara Rullfacebook-github-bot
authored andcommitted
Standarise log_tag, msg on scuba samples for loadshedding and rate limiting
Summary: The current issue is tha tloadshedding and ratelimitting leverage different columns for detailed logging, see https://fburl.com/scuba/mononoke_test_perf/atdsnwdz So I want ratelimiting logging to look more like the loadshedding one, so I'm adding a generic log tag and moving the specific logging to msg Reviewed By: lmvasquezg Differential Revision: D75142266 fbshipit-source-id: 91c2389ed32bf15a3f022f041b579cd0e54ea33c
1 parent 9e8302d commit 0033dfd

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

eden/mononoke/edenapi_service/src/utils/rate_limit.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,12 @@ pub async fn counter_check_and_bump<'a>(
8282
count,
8383
max_value,
8484
);
85+
let log_tag = "Request would have been rejected due to rate limiting, but enforcement is disabled";
8586
let msg = format!(
8687
"Rate limit exceeded: {}, limit: {} (log only)",
8788
rate_limit_name, max_value
8889
);
89-
scuba.log_with_msg(&msg, None);
90+
scuba.log_with_msg(log_tag, msg);
9091
Ok(())
9192
} else {
9293
debug!(
@@ -96,11 +97,12 @@ pub async fn counter_check_and_bump<'a>(
9697
count,
9798
max_value,
9899
);
100+
let log_tag = "Request rejected due to rate limiting";
99101
let msg = format!(
100102
"Rate limit exceeded: {}, limit: {} (enforced)",
101103
rate_limit_name, max_value
102104
);
103-
scuba.log_with_msg(&msg, None);
105+
scuba.log_with_msg(log_tag, msg.clone());
104106
Err(anyhow!(msg))
105107
}
106108
}
@@ -115,10 +117,10 @@ pub async fn counter_check_and_bump<'a>(
115117
Ok(())
116118
}
117119
Err(_) => {
118-
let msg = format!("{}: Timed out", rate_limit_name);
119-
scuba.log_with_msg(&msg, None);
120+
let log_tag = "Rate limiting counter fetch timed out";
121+
let msg = format!("Rate limit {}: Timed out", rate_limit_name);
122+
scuba.log_with_msg(log_tag, Some(msg));
120123
// Fail open to prevent DoS as we can't check the rate limit
121-
122124
Ok(())
123125
}
124126
}

0 commit comments

Comments
 (0)