-
Notifications
You must be signed in to change notification settings - Fork 98
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
Add local rate limiting #69
Conversation
This adds a local rate limiter filter that applies to traffic destined to a proxy's endpoints. Fixes #5
We could add this to: https://github.com/googleforgames/quilkin/blob/master/src/extensions/mod.rs#L31-L35 (As a side note, this is starting to feel like we really need some docs!!!) Did we want to write an integration test for this in this PR, or will it be coming later? |
I'm thinking rate limiting isn't something a user would want as default since then we need to know what's a reasonable value? Or do we add it there only in the meantime?
Do we have plans/suggestions regarding what framework/format etc to use for docs we can start looking into (Not really versed with requirements to get a docs site up and running 😅)?
tbh I didn't have any integration test plans for this 😅 mostly because I'm lazy but also didn't think an integration test adds something that we can't cover with a unit test since the functionality is limited to this module. Did you have something in mind? |
Blerg! I think that needs to be a clearer name then. That method exposes what filters are available to be used from a configuration. Basically it registers them with the FilterRegistry (hence also the need for docs, i.e. "how do I write a filter") .Any filter we write that can be used from the YAML (and eventually gRPC) is registered with the FilterRegistry, so the system has somewhere to look for the list of available filters.
I would start with a /docs folder and some .md files. If we need more complicated than that, then we can explore those options later.
Something simple that sends over the number of packets per second that a rate limit has, and it makes sure it only get the set amount would be nice. I always like integration tests, as it gives extra confidence that the thing actually works as expected when in conjunction with the whole piece together. (I need to write one for the DebugFilter for instance, make sure it actually sends everything though as expected). |
https://github.com/googleforgames/quilkin/blob/master/src/extensions/filter_registry.rs#L67 |
I missed much of the implementation code on first pass through, and I see this takes a config -- all making much more sense 👍 I've got a PR for lazily creating filters, with their configs incoming shortly, your point was extremely valid, and actually made me find a way to get configs passed to Filters - so thanks! Looking forward to your feedback on the approach. |
This looks great, the only things I was going to mention:
Other than that, happy to merge. |
Not sure how github handles this, the only way I can find is to rebase and change the commit message which will be painful since I've merged from master into this branch. |
I fixed it by editing the comment for you 😄 I'll respond to the rest on the ticket. |
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.
LGTM!
This adds a local rate limiter filter that applies to
traffic destined to a proxy's endpoints.
Work on #5
Since we don't currently have logic to initialize filters, the filter isn't used outside of the tests so there are a few
#[allow(dead_code)]
to silence the unused warnings