Skip to content

MaxQueryComplexityInstrumentation whitelist #2547

Closed

Description

@stevenleeDB

We would like to whitelist some operations based on their operation name, even if they exceed the max query complexity. Is there a way to do this?

If not, could we submit a PR to do this, possibly by adding more fields to QueryComplexityInfo so that the maxQueryComplexityExceeded function can check if the given operation is in the whitelist?

Activity

  1. bbakerman commented on Sep 19, 2021

    @bbakerman
    Member

    There is a function that is called to decide if an exception should be thrown

                    boolean throwAbortException = maxQueryComplexityExceededFunction.apply(queryComplexityInfo);
                    if (throwAbortException) {
                        throw mkAbortException(totalComplexity, maxComplexity);
                    }
    
        public MaxQueryComplexityInstrumentation(int maxComplexity, Function<QueryComplexityInfo, Boolean> maxQueryComplexityExceededFunction) {
    
    

    So I guess whats missing is enough "context information" to know what the query operation is etc..

    graphql.execution.instrumentation.parameters.InstrumentationValidationParameters is present so what ever is in there could be passed on in the QueryComplexityInfo object say

    So yes a PR to do this would be great

  2. added this to the 18.0 milestone on Sep 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions