-
Notifications
You must be signed in to change notification settings - Fork 11.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TrafficControl] Scale spam sample weight by request size #21373
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
2 Skipped Deployments
|
fa4df00
to
10b720e
Compare
10b720e
to
3e8eba1
Compare
async move { | ||
if let Some(traffic_controller) = traffic_controller { | ||
let client = req.extensions().get::<IpAddr>().cloned(); | ||
if let Err(response) = handle_traffic_req(&traffic_controller, &client).await { | ||
response | ||
} else { | ||
// Scale the weight based on the request size | ||
let spam_weight = if policy_config.unwrap().weight_spam_by_request_size { | ||
println!("TESTING -- weighting spam by request size"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't want to merge this i assume
let params_count = req.params.as_ref().and_then(|p| { | ||
let raw_value = p.get(); | ||
let params: Option<Vec<serde_json::Value>> = | ||
serde_json::from_str(raw_value).ok(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this won't handle nested params, right? I no it is a bit more fragile and has a lot of boilerplate but i wonder if the request handler needs to explicitly determine a param count?
) { | ||
println!("TESTING -- spam_weight: {:?}", spam_weight); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
debugging code
oh sorry i didn't notice this was a draft. ignore my comments for now |
Description
Describe the changes or additions included in this PR.
Test plan
How did you test the new or updated feature?
Release notes
Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required.
For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates.