envelop icon indicating copy to clipboard operation
envelop copied to clipboard

Plugin idea: rate-limit based on query complexity

Open dotansimha opened this issue 3 years ago • 3 comments

Based on: https://github.com/dotansimha/envelop/pull/474#issuecomment-885756213

dotansimha avatar Jul 25 '21 15:07 dotansimha

Hi we wants to implement using envelop complexity rate limit similar to https://shopify.engineering/rate-limiting-graphql-apis-calculating-query-complexity (additional example in Monday API rate limit)

A bit more context on our use case, we open public GraphQL API and want that each api token will have budget per timeframe like minute/hour.

idanwe avatar Aug 17 '21 10:08 idanwe

@idanwe I already started working on this, but haven't gotten back to it yet, I hopt to pick it up soon. This is something we really need for everyone!

n1ru4l avatar Aug 17 '21 10:08 n1ru4l

@idanwe I just opened a pull request for this over here: https://github.com/dotansimha/envelop/pull/671

I did not start writing any documentation, but you can already have a look at the test cases :)

I think this plugin should replace https://github.com/dotansimha/envelop/pull/474 as it supports both being used to apply complexity rules for a single operation as well as apply complexity rules over a timeframe. The latter is opt-in.

n1ru4l avatar Sep 12 '21 16:09 n1ru4l