Page MenuHomePhabricator

Client Developer gets rate limit headers
Closed, ResolvedPublic

Description

"As a Client Developer, I want to have informational HTTP headers in my response that say what my rate limit is and how many requests I still have available, so that I can throttle my requests to avoid going over the limit."

Different services use different proprietary headers for rate-limit information. We can use those, define our own, or use the draft RFC for rate-limit headers from the IETF.

Note that this is for successful and error messages.

This is done when:

  • Our responses follow the RFC for rate limit headers
  • Every response has rate limit in the headers (somewhere) or we know why not
  • Every response has remaining calls in the headers (somewhere) or we know why not
  • Every response has reset time in the headers (somewhere) or we know why not

Event Timeline

eprodromou added subscribers: hnowlan, Pchelolo.

It would be great to get some information on what these headers are going to be.

@Pchelolo and @hnowlan do we have an idea what the headers are that come out of the Envoy rate-limiting implementation?

I thought envoy was supporting this out of the box, but apparently it does not :( We need to make an upstream contribution one more time.

Filed https://github.com/envoyproxy/envoy/issues/12356 and awaiting approval from envoy maintainers.

eprodromou updated the task description. (Show Details)
eprodromou updated the task description. (Show Details)

The first in the series of patches needed for this has been merged upstream.

Now we need to wait for either of the following before continuing the work:
a) new version of https://github.com/envoyproxy/go-control-plane to be released, so that upstream ratelimit service could be updated to support X-RateLimit-Reset header
b) new version of envoy to be cut and used in the gateway

@Pchelolo: What's the release plan for Option A? When would a new version of Envoy be cut and used in the Gateway? I'd like to get a better sense of when we'll be able to remove this blocker. Are there any workarounds?

@Pchelolo: What's the release plan for Option A? When would a new version of Envoy be cut and used in the Gateway? I'd like to get a better sense of when we'll be able to remove this blocker.

According to this in the end of September.

Are there any workarounds?

No. This is an unimportant feature and we definitely shouldn't invest any more time into thinking about it then we already did.

Change 692941 had a related patch set uploaded (by Ppchelko; author: Ppchelko):

[operations/docker-images/production-images@master] ratelimiter: update to new upstream version

https://gerrit.wikimedia.org/r/692941

Change 692946 had a related patch set uploaded (by Ppchelko; author: Ppchelko):

[operations/deployment-charts@master] Api-gateway: enable x-ratelimit-* headers

https://gerrit.wikimedia.org/r/692946

Change 692941 merged by Hnowlan:

[operations/docker-images/production-images@master] ratelimiter: update to new upstream version

https://gerrit.wikimedia.org/r/692941

Change 692946 merged by jenkins-bot:

[operations/deployment-charts@master] Api-gateway: enable x-ratelimit-* headers

https://gerrit.wikimedia.org/r/692946

curl -iS 'https://api.wikimedia.org/core/v1/wikipedia/en/search/page?q=petr' | grep x-ratelimit

x-ratelimit-limit: 500, 500;w=3600
x-ratelimit-remaining: 495
x-ratelimit-reset: 3172