enable rate limit for month and year#743
Conversation
Signed-off-by: Rico Pahlisch <pahli88@googlemail.com> Signed-off-by: Rico Pahlisch <rico.pahlisch@grayc.de>
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.
should this be 365 instead?
What type of PR is this?
adds the option to set rate limit unit to
MonthandYearwhich was introduced with envoy 1.25.