Rate limit application monitoring best practice


I am currently developing an almost real-time rate limit monitoring dashboard, and I was wondering what was the best practice to use.

To my understanding and with the documentation, rate-limits are reset every minute at a specific second (X-Rate-Limit-Reset). However, to make my tool more accurate, I need the max rate limit used in 1 minute.

Currently, I have 2 solutions, one is to wait until the last second before making a call to the endpoint and fetch the rate-limit-remaining from the header. One problem with that, is that i need to make 2 requests (one to get the rate-limit-reset, and another for the “max” rate-limit-remaining), and wait the the rate-limit-reset.

The second one is to make 1 API call, and make an extrapolation for the “max” rate-limit-remaining in that minute.

Both of these methods have their own drawbacks, and i was wondering if you had any other solution i could use.