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
Feature/local-rate-limiter #1703
base: main
Are you sure you want to change the base?
Feature/local-rate-limiter #1703
Conversation
I'd rather not introduce another dependency. Gateway already depends on resilence4j, would you be willing to rework and use that library since we already manage it? https://github.com/resilience4j/resilience4j#ratelimiter |
Hi @spencergibb I am more than happy to use the one you mentioned! |
perfect |
Hi @spencergibb ! The rate limiter has been switched to the resilience4j rate limiter. Currently I am working on the testing. |
Codecov Report
@@ Coverage Diff @@
## master #1703 +/- ##
============================================
+ Coverage 74.21% 78.17% +3.96%
+ Complexity 1262 1240 -22
============================================
Files 166 158 -8
Lines 5413 5032 -381
Branches 420 401 -19
============================================
- Hits 4017 3934 -83
+ Misses 1178 890 -288
+ Partials 218 208 -10
Continue to review full report at Codecov.
|
The related ticket is #88 |
73d934e
to
5bd5791
Compare
Hi, Is this going to be merged or does it needs a rework? I think it can be quite a useful feature. |
@korektur I am available if people want to reboot it. |
Throwable exception = exchange | ||
.getAttribute(CIRCUITBREAKER_EXECUTION_EXCEPTION_ATTR); | ||
ServerWebExchange filteredExchange; | ||
if (exception == null) { |
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.
filteredExchange = exception == null ? exchange : addFallbackHeaders(config, exchange, exception);
1dc0e8a
to
9efafe8
Compare
Hey, +1 for this one, it's a pretty useful feature without setting separated component like redis. @spencergibb is that PR not merged only due to codecov check? Not mentioning current conflicts ofc. @gkatzioura would you still have a will to finish this PR? |
Hi @mafias |
+1 |
Is your feature request related to a problem? Please describe.
This feature adds a Local Rate Limiter using the bucket4j library. Devs who do not want to use the Redis limiter and avoid the IO might find this rate limiter useful.
Describe the solution you'd like
The local rate limiter gives a simple ratelimiter that operates the same way the Redis one does. It can be useful on scenarios of singular rate-limiter or a hot stand-by.
Describe alternatives you've considered
The alternatives considered is to avoid the bucket4j and implement the token bucket algorithm.
Additional context
This rate limiter will work is the Bucket4j library is included and if there is not Redis and Redis Rate Limiter related configuration present.