Add RateLimit middleware using TokenBucket algorithm#557
Add RateLimit middleware using TokenBucket algorithm#557LaPetiteSouris wants to merge 8 commits intoflyteorg:masterfrom
Conversation
|
Thank you for opening this pull request! 🙌 These tips will help get your PR across the finish line:
|
b4f04b6 to
064a129
Compare
EngHabu
left a comment
There was a problem hiding this comment.
Thank you for your contribution!
Codecov Report
@@ Coverage Diff @@
## master #557 +/- ##
==========================================
+ Coverage 58.42% 60.03% +1.60%
==========================================
Files 168 169 +1
Lines 16153 13265 -2888
==========================================
- Hits 9438 7964 -1474
+ Misses 5875 4461 -1414
Partials 840 840
Flags with carried forward coverage won't be shown. Click here to find out more.
|
064a129 to
8cbb5c0
Compare
|
Would anyone be available to re-review my PR or may be at least approve the workflows so that I have visibility on what are the remaining to fix/improve ? Thanks a lot. |
|
Thanks for launching the CI/CD for me. The |
Correct. Fixing the flaky test in #563. |
Thanks. I synced the PR with |
|
@LaPetiteSouris , can you merge master instead? This last update brought commits that don't have to do with your changes. |
5bd1cf3 to
b2383af
Compare
Signed-off-by: TungHoang <sontunghoang@gmail.com>
Signed-off-by: TungHoang <sontunghoang@gmail.com>
Signed-off-by: TungHoang <sontunghoang@gmail.com>
Signed-off-by: TungHoang <sontunghoang@gmail.com>
Signed-off-by: TungHoang <sontunghoang@gmail.com>
Signed-off-by: TungHoang <sontunghoang@gmail.com>
Signed-off-by: TungHoang <sontunghoang@gmail.com>
Signed-off-by: TungHoang <sontunghoang@gmail.com>
b2383af to
dfaf183
Compare
|
@eapolinario Sorry for that. I did not pay attention. I rebase to |
eapolinario
left a comment
There was a problem hiding this comment.
If I understand correctly, we're essentially having a version of sync.Map with TTL. So just to make the code more readable, how about we move that logic behind a new type that does only that?
| if !accessRecord.(*accessRecords).limiter.Allow() { | ||
| return RateLimitExceeded(fmt.Errorf("rate limit exceeded")) | ||
| } |
There was a problem hiding this comment.
shouldn't this happen before we modify the map?
TL;DR
Solve flyteorg/flyte#327
Type
Are all requirements met?
Complete description
Main changes
userIDandrateper user ID.rateis a native Golang package to track total count of requests.authpackage. In fact, the best way to uniquely identify requests to rate limit is to track usage per authenticated user.Tradeoff
flyteadminis deployed. If this is the case and we are serious about rate limit, another improvement is needed, like introduction of Redis for example, which is out of scopes for this PR.Tracking Issue
Remove the 'fixes' keyword if there will be multiple PRs to fix the linked issue
fixes flyteorg/flyte#327
Follow-up issue
NA