-
Notifications
You must be signed in to change notification settings - Fork 457
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
Explicit unlimited ratelimits #261
Explicit unlimited ratelimits #261
Conversation
a25a722
to
167963c
Compare
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.
Thanks for adding this. Can you add some documentation and then we can go from there? Thank you.
/wait
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.
/wait
Sorry can you fix DCO? Feel free to force push in this case and then we can continue the review from there. /wait |
Signed-off-by: lmajercak-wish <[email protected]>
Signed-off-by: lmajercak-wish <[email protected]>
Signed-off-by: lmajercak-wish <[email protected]>
Signed-off-by: lmajercak-wish <[email protected]>
Signed-off-by: lmajercak-wish <[email protected]>
Signed-off-by: lmajercak-wish <[email protected]>
Signed-off-by: lmajercak-wish <[email protected]>
d59efa8
to
6a81d9b
Compare
done |
Hi @mattklein123, would you be able to take a look again? Thanks! :) |
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.
Thanks LGTM with small comments.
/wait
src/config/config_impl.go
Outdated
value, present := | ||
pb.RateLimitResponse_RateLimit_Unit_value[strings.ToUpper(descriptorConfig.RateLimit.Unit)] | ||
if !present || value == int32(pb.RateLimitResponse_RateLimit_UNKNOWN) { | ||
if (!present || value == int32(pb.RateLimitResponse_RateLimit_UNKNOWN)) && !unlimited { |
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.
Can you split this logic out so that we actually check if unlimited is set with a unit at all and have an error message (and test) for that? I think that would be more clear to the user.
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.
(Ping on this)
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.
I wasn't too sure what exactly you meant, so please review this again :)
Signed-off-by: lmajercak-wish <[email protected]>
c854586
to
01de07f
Compare
Signed-off-by: lmajercak-wish <[email protected]>
2290800
to
2d18c1c
Compare
Signed-off-by: lmajercak-wish <[email protected]>
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.
/wait
README.md
Outdated
requests_per_unit: 100 | ||
``` | ||
|
||
For an unlimited descriptor, the request will not be sent to the underlying cache (Redis/Memcached), but will be quickly returned locally by the ratelimit instance. |
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.
Can you mention why someone would want to do this? I assume for stats, etc.?
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.
Well, stats yes. But also, in our case, our client will not allow a request to go through if a descriptor is not found, so we do have to have it defined.
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.
I'll add something to the readme
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.
Added
src/config/config_impl.go
Outdated
value, present := | ||
pb.RateLimitResponse_RateLimit_Unit_value[strings.ToUpper(descriptorConfig.RateLimit.Unit)] | ||
if !present || value == int32(pb.RateLimitResponse_RateLimit_UNKNOWN) { | ||
if (!present || value == int32(pb.RateLimitResponse_RateLimit_UNKNOWN)) && !unlimited { |
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.
(Ping on this)
283c882
to
7adeec5
Compare
Please do not force push after the PR is started. It breaks the review process. Just merge main and add commits. Thank you! |
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.
Thanks LGTM with a small doc comment.
/wait
if isUnlimited[i] { | ||
response.Statuses[i] = &pb.RateLimitResponse_DescriptorStatus{ | ||
Code: pb.RateLimitResponse_OK, | ||
LimitRemaining: math.MaxUint32, |
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.
Can you document this somewhere? It should probably go directly in the proto docs as a comment? Or potentially also somewhere in the README?
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.
Not sure what you mean by the proto docs, I added a comment to the README
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.
I mean doing a PR here also: https://github.com/envoyproxy/envoy/blob/7c1991ffe382bacf2bf415a643c5ea7428d0880e/api/envoy/service/ratelimit/v3/rls.proto#L130-L131
This is the canonical service definition for the ratelimit service.
I just followed the DCO steps |
35e338b
to
5b69edf
Compare
@lmajercak-wish now that DCO is broken you will need to squash and force push, so please do that. In the future please make sure to only add commits and sign off each commit. Thank you! /wait |
5b69edf
to
629323a
Compare
629323a
to
2d561da
Compare
Signed-off-by: lmajercak-wish <[email protected]>
2d561da
to
0862dd8
Compare
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.
Thanks!
Oops looks like CI issue. /wait |
Signed-off-by: lmajercak-wish <[email protected]>
Signed-off-by: lmajercak-wish <[email protected]>
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.
Thank you!
Thank you @mattklein123 ! |
Signed-off-by: lmajercak-wish <[email protected]>
Signed-off-by: lmajercak-wish <[email protected]>
Provide the ability to explicitly set a rate limit descriptor to be unlimited to avoid calls to redis/memcached.
#241