-
Notifications
You must be signed in to change notification settings - Fork 458
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
enable rate limit for month and year #743
Conversation
Signed-off-by: Rico Pahlisch <[email protected]> Signed-off-by: Rico Pahlisch <[email protected]>
a09cbb0
to
e91afbd
Compare
Thanks @rpahli just came here to open the same PR myself, good thing I looked first 😆 @collin-lee anything preventing this one from being merged? kicking off a project using the ratelimit service and monthly limits sure would be handy. |
LGTM though do you expect that your service/redis would not need to be restarted for re-deployments monthly/yearly? |
For our use-case I had just planned to enable persistence in redis, my ultimate goal here was to add support for an additional weekly bucket, however looking at the enums over in https://github.com/tyxia/envoy/blob/b5bc27399d723806bab993895e64f9295c863016/api/envoy/service/ratelimit/v3/rls.proto#L101 it will be a breaking change to sneak WEEK in there now... |
not sure I understand @collin-lee, this functionality didn't exist before, so users will need to update to a newer version with this change to leverage setting month and year limits in the ratelimit service. |
@arkodg - my question was more about the use case and @stefansedich mentioned he would persist redis values. @stefansedich - so could you do a multiple of days for weeks/months instead? (i.e 7 days for a week, 30 days for a month)? |
That would be fine too, it just means something like #552 going in which in the end would be far more flexible and a nice addition. I have gone ahead and added WEEK for now over in envoyproxy/envoy#37494 as I think it makes sense that it exists given we have month and year already, will open a PR here to add support once it gets merged (if it does). |
@collin-lee anything remaining to get this one in? I am happy to do some additional testing if that would help. |
@stefansedich - should the code |
the base unit is seconds so I think the code is correct |
@collin-lee looks right to me as the output is seconds, and replicates what was done over on the Envoy side. |
case pb.RateLimitResponse_RateLimit_MONTH: | ||
return 60 * 60 * 24 * 30 | ||
case pb.RateLimitResponse_RateLimit_YEAR: | ||
return 60 * 60 * 24 * 356 |
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.
should this be 365 instead?
What type of PR is this?
adds the option to set rate limit unit to
Month
andYear
which was introduced with envoy 1.25.