HAProxy rate limit info is not included in API responses

Summary

Rate limit data is not included in the responses from the GitLab API. However the documentation at https://docs.gitlab.com/ee/user/gitlab_com/index.html#haproxy-api-throttle says that:

The following example headers are included for all API requests:

RateLimit-Limit: 600
RateLimit-Observed: 6
RateLimit-Remaining: 594
RateLimit-Reset: 1563325137
RateLimit-ResetTime: Wed, 17 Jul 2019 00:58:57 GMT

I'm not sure if this is related to https://about.gitlab.com/releases/2020/05/06/gitlab-com-13-0-breaking-changes/. I wasn't able to find any reference about it.

It seems that this info was there before May 10th. We have a Jenkins job that syncs the data collected from GitLab with our servers every day, the job started failing on that day (see below a snippet).

File "/usr/local/lib/jenkins_ticket_utils/scripts/discrepancy.py", line 117, in no_exist
    ratelimit_remaining = int(re.headers['RateLimit-Remaining'])
  File "/var/lib/jenkins/.local/lib/python3.5/site-packages/requests/structures.py", line 54, in __getitem__
    return self._store[key.lower()][1]
KeyError: 'ratelimit-remaining'

Steps to reproduce

Any curl call to a target repo/issue is enough to reproduce the issue.

Example Project

https://gitlab.com/gitlab-org/omnibus-gitlab, project ID 20699

curl -XGET https://gitlab.com/api/v4/projects/20699/issues/5336 -i -H --header "PRIVATE-TOKEN: <your-token>"
HTTP/2 200 
date: Mon, 11 May 2020 08:27:51 GMT
content-type: application/json
content-length: 6659
set-cookie: __cfduid=dbaed0d01bd6e6a5252fbb18e78c78aa31589185671; expires=Wed, 10-Jun-20 08:27:51 GMT; path=/; domain=.gitlab.com; HttpOnly; SameSite=Lax; Secure
cache-control: max-age=0, private, must-revalidate
etag: W/"5c5ffdaf51fb7300c0c20450e878462d"
vary: Origin
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
x-request-id: 0k2rTCJySe9
x-runtime: 0.063342
strict-transport-security: max-age=31536000
referrer-policy: strict-origin-when-cross-origin
gitlab-lb: fe-02-lb-gprd
gitlab-sv: api-20-sv-gprd
cf-cache-status: DYNAMIC
expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
server: cloudflare
cf-ray: 591a85eeacd7ff6c-MAD
cf-request-id: 02a472092d0000ff6cfb11b200000001

What is the current bug behavior?

Rate limit data is not returned in the API responses.

What is the expected correct behavior?

From the documentation at https://docs.gitlab.com/ee/user/gitlab_com/index.html#haproxy-api-throttle, I understand that the rate limit data should be returned in every API response.

Edited by Michael Kozono