@PublicApi public class DataLoaderDispatcherInstrumentation extends SimplePerformantInstrumentation
Instrumentation
will dispatch
all the contained DataLoader
s when each level of the graphql
query is executed.
This allows you to use DataLoader
s in your DataFetcher
s
to optimal loading of data.
A DataLoaderDispatcherInstrumentation will be automatically added to the GraphQL
instrumentation list if one is not present.
DataLoader
,
DataLoaderRegistry
INSTANCE
Constructor and Description |
---|
DataLoaderDispatcherInstrumentation()
Creates a DataLoaderDispatcherInstrumentation with the default options
|
DataLoaderDispatcherInstrumentation(DataLoaderDispatcherInstrumentationOptions options)
Creates a DataLoaderDispatcherInstrumentation with the specified options
|
Modifier and Type | Method and Description |
---|---|
@Nullable InstrumentationContext<ExecutionResult> |
beginExecuteOperation(InstrumentationExecuteOperationParameters parameters,
InstrumentationState rawState)
This is called just before the execution of the query operation is started.
|
@Nullable ExecutionStrategyInstrumentationContext |
beginExecutionStrategy(InstrumentationExecutionStrategyParameters parameters,
InstrumentationState rawState)
This is called each time an
ExecutionStrategy is invoked, which may be multiple times
per query as the engine recursively descends down over the query. |
@Nullable InstrumentationContext<java.lang.Object> |
beginFieldFetch(InstrumentationFieldFetchParameters parameters,
InstrumentationState rawState)
This is called just before a field
DataFetcher is invoked. |
InstrumentationState |
createState(InstrumentationCreateStateParameters parameters)
This will be called just before execution to create an object that is given back to all instrumentation methods
to allow them to have per execution request state
|
@NotNull DataFetcher<?> |
instrumentDataFetcher(DataFetcher<?> dataFetcher,
InstrumentationFieldFetchParameters parameters,
InstrumentationState rawState)
This is called to instrument a
DataFetcher just before it is used to fetch a field, allowing you
to adjust what information is passed back or record information about specific data fetches. |
@NotNull java.util.concurrent.CompletableFuture<ExecutionResult> |
instrumentExecutionResult(ExecutionResult executionResult,
InstrumentationExecutionParameters parameters,
InstrumentationState rawState)
This is called to allow instrumentation to instrument the execution result in some way
|
beginExecuteOperation, beginExecution, beginExecution, beginExecutionStrategy, beginField, beginField, beginFieldComplete, beginFieldComplete, beginFieldFetch, beginFieldListComplete, beginFieldListComplete, beginParse, beginParse, beginSubscribedFieldEvent, beginSubscribedFieldEvent, beginValidation, beginValidation, createState, instrumentDataFetcher, instrumentDocumentAndVariables, instrumentDocumentAndVariables, instrumentExecutionContext, instrumentExecutionContext, instrumentExecutionInput, instrumentExecutionInput, instrumentExecutionResult, instrumentSchema, instrumentSchema
public DataLoaderDispatcherInstrumentation()
public DataLoaderDispatcherInstrumentation(DataLoaderDispatcherInstrumentationOptions options)
options
- the options to control the behaviourpublic InstrumentationState createState(InstrumentationCreateStateParameters parameters)
Instrumentation
createState
in interface Instrumentation
createState
in class SimplePerformantInstrumentation
parameters
- the parameters to this step@NotNull public @NotNull DataFetcher<?> instrumentDataFetcher(DataFetcher<?> dataFetcher, InstrumentationFieldFetchParameters parameters, InstrumentationState rawState)
Instrumentation
DataFetcher
just before it is used to fetch a field, allowing you
to adjust what information is passed back or record information about specific data fetches. Note
the same data fetcher instance maybe presented to you many times and that data fetcher
implementations widely vary.instrumentDataFetcher
in interface Instrumentation
instrumentDataFetcher
in class SimplePerformantInstrumentation
dataFetcher
- the data fetcher about to be usedparameters
- the parameters describing the field to be fetchedrawState
- the state created during the call to Instrumentation.createState(InstrumentationCreateStateParameters)
@Nullable public @Nullable InstrumentationContext<ExecutionResult> beginExecuteOperation(InstrumentationExecuteOperationParameters parameters, InstrumentationState rawState)
Instrumentation
beginExecuteOperation
in interface Instrumentation
beginExecuteOperation
in class SimplePerformantInstrumentation
parameters
- the parameters to this steprawState
- the state created during the call to Instrumentation.createState(InstrumentationCreateStateParameters)
InstrumentationContext
object that will be called back when the step ends (assuming it's not null)@Nullable public @Nullable ExecutionStrategyInstrumentationContext beginExecutionStrategy(InstrumentationExecutionStrategyParameters parameters, InstrumentationState rawState)
Instrumentation
ExecutionStrategy
is invoked, which may be multiple times
per query as the engine recursively descends down over the query.beginExecutionStrategy
in interface Instrumentation
beginExecutionStrategy
in class SimplePerformantInstrumentation
parameters
- the parameters to this steprawState
- the state created during the call to Instrumentation.createState(InstrumentationCreateStateParameters)
ExecutionStrategyInstrumentationContext
object that will be called back when the step ends (assuming it's not null)@Nullable public @Nullable InstrumentationContext<java.lang.Object> beginFieldFetch(InstrumentationFieldFetchParameters parameters, InstrumentationState rawState)
Instrumentation
DataFetcher
is invoked.beginFieldFetch
in interface Instrumentation
beginFieldFetch
in class SimplePerformantInstrumentation
parameters
- the parameters to this steprawState
- the state created during the call to Instrumentation.createState(InstrumentationCreateStateParameters)
InstrumentationContext
object that will be called back when the step ends (assuming it's not null)@NotNull public @NotNull java.util.concurrent.CompletableFuture<ExecutionResult> instrumentExecutionResult(ExecutionResult executionResult, InstrumentationExecutionParameters parameters, InstrumentationState rawState)
Instrumentation
instrumentExecutionResult
in interface Instrumentation
instrumentExecutionResult
in class SimplePerformantInstrumentation
executionResult
- CompletableFuture
of the result to instrumentparameters
- the parameters to this steprawState
- the state created during the call to Instrumentation.createState(InstrumentationCreateStateParameters)