Limit query cost

Define a maximum cost applied to any query, regardless of whether or not the call is within the rate limits for a consumer.

By defining a max_cost on the upstream service, you ensure that no query will run with a cost higher than the set max_cost. By default it’s set to 0, which means no limit.

Prerequisites

  • You have an existing a GraphQL upstream service.

Set up the plugin

Add this section to your declarative configuration file:

_format_version: "3.0"
plugins:
  - name: graphql-rate-limiting-advanced
    config:
      limit:
      - 100
      window_size:
      - 60
      window_type: fixed
      cost_strategy: node_quantifier
      max_cost: 5000
      sync_rate: 0
Copied to clipboard!

Did this doc help?

Something wrong?

Help us make these docs great!

Kong Developer docs are open source. If you find these useful and want to make them better, contribute today!