@PublicApi public class MaxQueryComplexityInstrumentation extends SimpleInstrumentation
INSTANCE
Constructor and Description |
---|
MaxQueryComplexityInstrumentation(int maxComplexity)
new Instrumentation with default complexity calculator which is `1 + childComplexity`
|
MaxQueryComplexityInstrumentation(int maxComplexity,
FieldComplexityCalculator fieldComplexityCalculator)
new Instrumentation with custom complexity calculator
|
Modifier and Type | Method and Description |
---|---|
InstrumentationContext<java.util.List<ValidationError>> |
beginValidation(InstrumentationValidationParameters parameters)
This is called just before the parsed query document is validated.
|
protected AbortExecutionException |
mkAbortException(int totalComplexity,
int maxComplexity)
Called to generate your own error message or custom exception class
|
beginDeferredField, beginExecuteOperation, beginExecution, beginExecutionStrategy, beginField, beginFieldComplete, beginFieldFetch, beginFieldListComplete, beginParse, createState, instrumentDataFetcher, instrumentExecutionContext, instrumentExecutionResult, instrumentSchema
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
instrumentExecutionInput
public MaxQueryComplexityInstrumentation(int maxComplexity)
maxComplexity
- max allowed complexity, otherwise execution will be abortedpublic MaxQueryComplexityInstrumentation(int maxComplexity, FieldComplexityCalculator fieldComplexityCalculator)
maxComplexity
- max allowed complexity, otherwise execution will be abortedfieldComplexityCalculator
- custom complexity calculatorpublic InstrumentationContext<java.util.List<ValidationError>> beginValidation(InstrumentationValidationParameters parameters)
Instrumentation
beginValidation
in interface Instrumentation
beginValidation
in class SimpleInstrumentation
parameters
- the parameters to this stepInstrumentationContext
object that will be called back when the step endsprotected AbortExecutionException mkAbortException(int totalComplexity, int maxComplexity)
totalComplexity
- the complexity of the querymaxComplexity
- the maximum complexity allowed