@PublicApi public class ChainedInstrumentation extends java.lang.Object implements Instrumentation
Instrumentation
implementations
and run them in sequence. The list order of instrumentation objects is always guaranteed to be followed and
the InstrumentationState
objects they create will be passed back to the originating
implementation.Instrumentation
Constructor and Description |
---|
ChainedInstrumentation(java.util.List<Instrumentation> instrumentations) |
Modifier and Type | Method and Description |
---|---|
InstrumentationContext<java.util.concurrent.CompletableFuture<ExecutionResult>> |
beginCompleteField(InstrumentationFieldCompleteParameters parameters)
This is called just before the complete field is started and when this step finishes the
InstrumentationContext.onEnd(Object, Throwable)
will be called indicating that the step has finished. |
InstrumentationContext<java.util.concurrent.CompletableFuture<ExecutionResult>> |
beginCompleteFieldList(InstrumentationFieldCompleteParameters parameters)
This is called just before the complete field list is started and when this step finishes the
InstrumentationContext.onEnd(Object, Throwable)
will be called indicating that the step has finished. |
InstrumentationContext<ExecutionResult> |
beginDataFetch(InstrumentationDataFetchParameters parameters)
This is called just before the data fetching stage is started, waits for all data to be completed and when this step finishes the
InstrumentationContext.onEnd(Object, Throwable)
will be called indicating that the step has finished. |
InstrumentationContext<java.util.concurrent.CompletableFuture<ExecutionResult>> |
beginDataFetchDispatch(InstrumentationDataFetchParameters parameters)
This is called just before the data fetching stage is started and finishes as soon as the query is dispatched ready for completion.
|
InstrumentationContext<ExecutionResult> |
beginExecution(InstrumentationExecutionParameters parameters)
This is called just before a query is executed and when this step finishes the
InstrumentationContext.onEnd(Object, Throwable)
will be called indicating that the step has finished. |
InstrumentationContext<java.util.concurrent.CompletableFuture<ExecutionResult>> |
beginExecutionStrategy(InstrumentationExecutionStrategyParameters parameters)
This is called each time the
ExecutionStrategy is invoked and when the
CompletableFuture has been dispatched for the query fields the
InstrumentationContext.onEnd(Object, Throwable)
is called. |
InstrumentationContext<ExecutionResult> |
beginField(InstrumentationFieldParameters parameters)
This is called just before a field is resolved and when this step finishes the
InstrumentationContext.onEnd(Object, Throwable)
will be called indicating that the step has finished. |
InstrumentationContext<java.lang.Object> |
beginFieldFetch(InstrumentationFieldFetchParameters parameters)
This is called just before a field
DataFetcher is invoked and when this step finishes the InstrumentationContext.onEnd(Object, Throwable)
will be called indicating that the step has finished. |
InstrumentationContext<java.util.Map<java.lang.String,java.util.List<Field>>> |
beginFields(InstrumentationExecutionStrategyParameters parameters)
This is called just before a selection set of fields is resolved and when this step finishes the
InstrumentationContext.onEnd(Object, Throwable)
will be called indicating that the step has finished. |
InstrumentationContext<Document> |
beginParse(InstrumentationExecutionParameters parameters)
This is called just before a query is parsed and when this step finishes the
InstrumentationContext.onEnd(Object, Throwable)
will be called indicating that the step has finished. |
InstrumentationContext<java.util.List<ValidationError>> |
beginValidation(InstrumentationValidationParameters parameters)
This is called just before the parsed query Document is validated and when this step finishes the
InstrumentationContext.onEnd(Object, Throwable)
will be called indicating that the step has finished. |
InstrumentationState |
createState()
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
|
DataFetcher<?> |
instrumentDataFetcher(DataFetcher<?> dataFetcher,
InstrumentationFieldFetchParameters parameters)
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. |
ExecutionContext |
instrumentExecutionContext(ExecutionContext executionContext,
InstrumentationExecutionParameters parameters)
This is called to instrument a
ExecutionContext before it is used to execute a query,
allowing you to adjust the base data used. |
ExecutionInput |
instrumentExecutionInput(ExecutionInput executionInput,
InstrumentationExecutionParameters parameters)
This is called to instrument a
ExecutionInput before it is used to parse, validate
and execute a query, allowing you to adjust what query input parameters are used |
java.util.concurrent.CompletableFuture<ExecutionResult> |
instrumentExecutionResult(ExecutionResult executionResult,
InstrumentationExecutionParameters parameters)
This is called to allow instrumentation to instrument the execution result in some way
|
GraphQLSchema |
instrumentSchema(GraphQLSchema schema,
InstrumentationExecutionParameters parameters)
This is called to instrument a
GraphQLSchema before it is used to parse, validate
and execute a query, allowing you to adjust what types are used. |
public ChainedInstrumentation(java.util.List<Instrumentation> instrumentations)
public InstrumentationState createState()
Instrumentation
createState
in interface Instrumentation
public InstrumentationContext<ExecutionResult> beginExecution(InstrumentationExecutionParameters parameters)
Instrumentation
InstrumentationContext.onEnd(Object, Throwable)
will be called indicating that the step has finished.beginExecution
in interface Instrumentation
parameters
- the parameters to this stepInstrumentationContext
object that will be called back when the step endspublic InstrumentationContext<Document> beginParse(InstrumentationExecutionParameters parameters)
Instrumentation
InstrumentationContext.onEnd(Object, Throwable)
will be called indicating that the step has finished.beginParse
in interface Instrumentation
parameters
- the parameters to this stepInstrumentationContext
object that will be called back when the step endspublic InstrumentationContext<java.util.List<ValidationError>> beginValidation(InstrumentationValidationParameters parameters)
Instrumentation
InstrumentationContext.onEnd(Object, Throwable)
will be called indicating that the step has finished.beginValidation
in interface Instrumentation
parameters
- the parameters to this stepInstrumentationContext
object that will be called back when the step endspublic InstrumentationContext<ExecutionResult> beginDataFetch(InstrumentationDataFetchParameters parameters)
Instrumentation
InstrumentationContext.onEnd(Object, Throwable)
will be called indicating that the step has finished.beginDataFetch
in interface Instrumentation
parameters
- the parameters to this stepInstrumentationContext
object that will be called back when the step endspublic InstrumentationContext<java.util.concurrent.CompletableFuture<ExecutionResult>> beginExecutionStrategy(InstrumentationExecutionStrategyParameters parameters)
Instrumentation
ExecutionStrategy
is invoked and when the
CompletableFuture
has been dispatched for the query fields the
InstrumentationContext.onEnd(Object, Throwable)
is called.
Note because the execution strategy execution is asynchronous, the query data is not guaranteed to be
completed when this step finishes. It is however a chance to dispatch side effects that might cause
asynchronous data fetching code to actually run or attach CompletableFuture handlers onto the result
via Instrumentation.beginExecutionStrategy
in interface Instrumentation
parameters
- the parameters to this stepInstrumentationContext
object that will be called back when the step endspublic InstrumentationContext<java.util.concurrent.CompletableFuture<ExecutionResult>> beginDataFetchDispatch(InstrumentationDataFetchParameters parameters)
Instrumentation
Instrumentation.beginDataFetch(graphql.execution.instrumentation.parameters.InstrumentationDataFetchParameters)
in that this step does not wait for the values to be completed, only dispatched for completion.beginDataFetchDispatch
in interface Instrumentation
parameters
- the parameters to this stepInstrumentationContext
object that will be called back when the step endspublic InstrumentationContext<java.util.Map<java.lang.String,java.util.List<Field>>> beginFields(InstrumentationExecutionStrategyParameters parameters)
Instrumentation
InstrumentationContext.onEnd(Object, Throwable)
will be called indicating that the step has finished.beginFields
in interface Instrumentation
parameters
- the parameters to this stepInstrumentationContext
object that will be called back when the step endspublic InstrumentationContext<ExecutionResult> beginField(InstrumentationFieldParameters parameters)
Instrumentation
InstrumentationContext.onEnd(Object, Throwable)
will be called indicating that the step has finished.beginField
in interface Instrumentation
parameters
- the parameters to this stepInstrumentationContext
object that will be called back when the step endspublic InstrumentationContext<java.lang.Object> beginFieldFetch(InstrumentationFieldFetchParameters parameters)
Instrumentation
DataFetcher
is invoked and when this step finishes the InstrumentationContext.onEnd(Object, Throwable)
will be called indicating that the step has finished.beginFieldFetch
in interface Instrumentation
parameters
- the parameters to this stepInstrumentationContext
object that will be called back when the step endspublic InstrumentationContext<java.util.concurrent.CompletableFuture<ExecutionResult>> beginCompleteField(InstrumentationFieldCompleteParameters parameters)
Instrumentation
InstrumentationContext.onEnd(Object, Throwable)
will be called indicating that the step has finished.beginCompleteField
in interface Instrumentation
parameters
- the parameters to this stepInstrumentationContext
object that will be called back when the step endspublic InstrumentationContext<java.util.concurrent.CompletableFuture<ExecutionResult>> beginCompleteFieldList(InstrumentationFieldCompleteParameters parameters)
Instrumentation
InstrumentationContext.onEnd(Object, Throwable)
will be called indicating that the step has finished.beginCompleteFieldList
in interface Instrumentation
parameters
- the parameters to this stepInstrumentationContext
object that will be called back when the step endspublic ExecutionInput instrumentExecutionInput(ExecutionInput executionInput, InstrumentationExecutionParameters parameters)
Instrumentation
ExecutionInput
before it is used to parse, validate
and execute a query, allowing you to adjust what query input parameters are usedinstrumentExecutionInput
in interface Instrumentation
executionInput
- the execution input to be usedparameters
- the parameters describing the field to be fetchedpublic GraphQLSchema instrumentSchema(GraphQLSchema schema, InstrumentationExecutionParameters parameters)
Instrumentation
GraphQLSchema
before it is used to parse, validate
and execute a query, allowing you to adjust what types are used.instrumentSchema
in interface Instrumentation
schema
- the schema to be usedparameters
- the parameters describing the field to be fetchedpublic ExecutionContext instrumentExecutionContext(ExecutionContext executionContext, InstrumentationExecutionParameters parameters)
Instrumentation
ExecutionContext
before it is used to execute a query,
allowing you to adjust the base data used.instrumentExecutionContext
in interface Instrumentation
executionContext
- the execution context to be usedparameters
- the parameters describing the field to be fetchedpublic DataFetcher<?> instrumentDataFetcher(DataFetcher<?> dataFetcher, InstrumentationFieldFetchParameters parameters)
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
dataFetcher
- the data fetcher about to be usedparameters
- the parameters describing the field to be fetchedpublic java.util.concurrent.CompletableFuture<ExecutionResult> instrumentExecutionResult(ExecutionResult executionResult, InstrumentationExecutionParameters parameters)
Instrumentation
instrumentExecutionResult
in interface Instrumentation
executionResult
- CompletableFuture
of the result to instrumentparameters
- the parameters to this step