Repository navigation
Implement additional rate limiter for v2 API calls - #2882
Merged
Merged
Conversation
johha
force-pushed
the
v2-api-rate-limiter
branch
from
July 25, 2022 13:55
8330c53 to
1dae194
Compare
- Make RequestCounter Singleton reusable - Introduce abstract/base rate limiter - Adopt existing rate limiter to new structure - Introduce helper class for rate limit headers
johha
force-pushed
the
v2-api-rate-limiter
branch
from
July 25, 2022 15:38
1dae194 to
efdd0d4
Compare
philippthun
reviewed
Jul 25, 2022
philippthun
reviewed
Jul 26, 2022
- Replace 'skip_rate_limiting' with 'apply_rate_limiting' - Code cleanup - Improve signatures & code structure - Use shared test examples - Fix admin test
johha
added a commit
to sap-contributions/capi-release
that referenced
this pull request
Jul 26, 2022
2 of 3 tasks
Member
Author
|
Related PR for configuration in capi-release: cloudfoundry/capi-release#254 |
johha
marked this pull request as ready for review
July 27, 2022 06:25
johha
added a commit
to sap-contributions/capi-release
that referenced
this pull request
Jul 29, 2022
johha
added a commit
to sap-contributions/capi-release
that referenced
this pull request
Jul 29, 2022
philippthun
approved these changes
Aug 1, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A explanation of the proposed change:
As v2 API is deprecated and v3 API has in general a better performance (at least on big foundations) we want to motivate users to migrate to v3 API.
We want to add a rate limiter for v2 API calls as an additional 'motivator'. This rate limiter distinguishes between requests from admin and regular users. It is disabled per default and can be configured by operators.
The v2 rate limiter reuses the logic of the general rate limiter. Main differences are the paths on which the rate limit will be skipped and the error messages.
To improve reuse between the general rate limiter and v2 rate limiter we introduced a base rate limiter which contains most of the logic (move over from general rate limiter).
This will also make it easier to implement further requests limiter.
If enabled users will see the following additional headers
An explanation of the use cases your change solves
As an operator I want to rate limit v2 API calls for regular (incl. unauthenticated) and admin users
Links to any other associated PRs
I have reviewed the contributing guide
I have viewed, signed, and submitted the Contributor License Agreement
I have made this pull request to the
mainbranchI have run all the unit tests using
bundle exec rakeI have run CF Acceptance Tests