fusio icon indicating copy to clipboard operation
fusio copied to clipboard

[QUESTION] Route to view rate limit information (without using rate limit points)?

Open Alvie opened this issue 4 years ago • 2 comments

Hello,

I was wondering if there is a route where users can view their rate limits.

I understand that it is shown on every response in the headers ( x-ratelimit-limit: 720, x-ratelimit-remaining: 710), but I was wondering if there was a simpler route that only returns the above information (perhaps as JSON or similar).

Also, if there was such a route, would it be possible to separate that route so it doesn't use the same points of the "Default" Consumer rate?

Thanks, Alvie

Alvie avatar Aug 25 '21 11:08 Alvie

Hi, thanks for the idea, so i think the problem is that the x-ratelimit-limit header depends always on the route which you call i.e. if you call the route /foo it has maybe other limits then the /bar route depending on the configured rates. Could you mabye explain your use case for this so maybe there is also another solution.

chriskapp avatar Aug 25 '21 17:08 chriskapp

Hi, thanks for the response. I didn't realize that the header depends on the route called. Sorry for my misunderstanding.

Essentially, I would like to be able to present a user with a progress bar on their usage of the rate limits via a dashboard, something like this: Screenshot_20210825-193300

Though I understand now that it may be different per route. Perhaps there could be a way to return the limits for each set of routes e.g.

{
    "Default": {
        "limit": 720,
        "remaining": 462
    },
    "route1": {
        "limit": 100,
        "remaining": 73
    },
    "route2": {
        "limit": 100,
        "remaining": 42
    }
}

Alvie avatar Aug 25 '21 18:08 Alvie