@PublicApi public class MaxQueryDepthInstrumentation extends SimpleInstrumentation
Function<QueryDepthInfo, Boolean> parameter to supply a function to perform a custom action when the max depth is
exceeded. If the function returns true a AbortExecutionException is thrown.INSTANCE| Constructor and Description |
|---|
MaxQueryDepthInstrumentation(int maxDepth)
Creates a new instrumentation that tracks the query depth.
|
MaxQueryDepthInstrumentation(int maxDepth,
java.util.function.Function<QueryDepthInfo,java.lang.Boolean> maxQueryDepthExceededFunction)
Creates a new instrumentation that tracks the query depth.
|
| Modifier and Type | Method and Description |
|---|---|
InstrumentationContext<ExecutionResult> |
beginExecuteOperation(InstrumentationExecuteOperationParameters parameters)
This is called just before the execution of the query operation is started.
|
protected AbortExecutionException |
mkAbortException(int depth,
int maxDepth)
Called to generate your own error message or custom exception class
|
beginExecution, beginExecutionStrategy, beginField, beginFieldFetch, beginParse, beginValidationclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitbeginExecuteOperation, beginExecution, beginExecutionStrategy, beginField, beginFieldComplete, beginFieldComplete, beginFieldFetch, beginFieldListComplete, beginFieldListComplete, beginParse, beginSubscribedFieldEvent, beginSubscribedFieldEvent, beginValidation, createState, createState, instrumentDataFetcher, instrumentDataFetcher, instrumentDocumentAndVariables, instrumentDocumentAndVariables, instrumentExecutionContext, instrumentExecutionContext, instrumentExecutionInput, instrumentExecutionInput, instrumentExecutionResult, instrumentExecutionResult, instrumentSchema, instrumentSchemapublic MaxQueryDepthInstrumentation(int maxDepth)
maxDepth - max allowed depth, otherwise execution will be abortedpublic MaxQueryDepthInstrumentation(int maxDepth,
java.util.function.Function<QueryDepthInfo,java.lang.Boolean> maxQueryDepthExceededFunction)
maxDepth - max allowed depth, otherwise execution will be abortedmaxQueryDepthExceededFunction - the function to perform when the max depth is exceededpublic InstrumentationContext<ExecutionResult> beginExecuteOperation(InstrumentationExecuteOperationParameters parameters)
InstrumentationbeginExecuteOperation in interface InstrumentationbeginExecuteOperation in class SimpleInstrumentationparameters - the parameters to this stepInstrumentationContext object that will be called back when the step endsprotected AbortExecutionException mkAbortException(int depth, int maxDepth)
depth - the depth of the querymaxDepth - the maximum depth allowed