Skip to content
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

Rate Limit headers #1166

Merged
merged 8 commits into from
Apr 1, 2020
Merged

Rate Limit headers #1166

merged 8 commits into from
Apr 1, 2020

Conversation

eloycoto
Copy link
Contributor

This PR adds a policy that enables rate-limits headers per service.

All changes explained in the commit messages.

@eloycoto eloycoto requested a review from a team as a code owner February 28, 2020 15:44
@eloycoto eloycoto force-pushed the RateLIMIT branch 4 times, most recently from bc875ba to 6bf516c Compare March 2, 2020 17:03
@unleashed
Copy link
Contributor

FYI @ioggstream

@eloycoto eloycoto force-pushed the RateLIMIT branch 2 times, most recently from 1cc3b58 to fbd341d Compare March 4, 2020 21:55
@eloycoto
Copy link
Contributor Author

eloycoto commented Mar 4, 2020

@davidor out for review

@davidor
Copy link
Contributor

davidor commented Mar 16, 2020

@unleashed as you are one of the authors of the RFC, it would be good if you could take a look at this PR. In particular, it would be great if you could review the documentation and the examples in the integration tests.

usage:encode_format: To return an string with the format encoded
url-encoded. It's used to communicate with backend and for caching
pourposes.

usage:get_max_delta: This method return the max number of deltas, it's
used to predict the number of hits in a metric in rate_limit_headers
policy.

Signed-off-by: Eloy Coto <[email protected]>
This commit add a single counter class, this class makes sure that a
counter is correctly set, and adds a simple methods increment/decrement.

The main purpose:

- Be able to write code and be descriptive.
- Have a custom methods on tostring, etc..
- Always check that it's a number, etc..

Not a lot of value added, but code is much clean to read when it's used.

Signed-off-by: Eloy Coto <[email protected]>
At the moment is quite difficult to subscribe to a backend event, so
getting information about apisonator responses in any policy is quite
challenging.

This commit adds two new methods in the request context:
`add_backend_auth_subscriber` and `publish_backend_auth`. When a policy
subscribes to a auth event, each time that publish_backend_auth is
called will execute the callback and policy can retrieve the
information.

Signed-off-by: Eloy Coto <[email protected]>
This policy adds rate limit headers into responses

Signed-off-by: Eloy Coto <[email protected]>
Signed-off-by: Eloy Coto <[email protected]>
Signed-off-by: Eloy Coto <[email protected]>
Signed-off-by: Eloy Coto <[email protected]>
Signed-off-by: Eloy Coto <[email protected]>
@eloycoto eloycoto merged commit 827aca2 into 3scale:master Apr 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants