Class NoContextChainedInstrumentation
- java.lang.Object
-
- graphql.execution.instrumentation.ChainedInstrumentation
-
- graphql.execution.instrumentation.NoContextChainedInstrumentation
-
- All Implemented Interfaces:
Instrumentation
@PublicApi public class NoContextChainedInstrumentation extends ChainedInstrumentation
This version ofChainedInstrumentation
will call a list ofInstrumentation
s but it will never back on the returnedInstrumentationContext
objects, hence it is only suitable to certain use cases. Only use this class if you are optimising for memory usage as scale. In most cases theChainedInstrumentation
will do the job required with all the instrumentation features used however some users require the fastest performance and lowest memory usage at scale and this class can be used. At scale, the fact that the graphql engine holds theInstrumentationContext
objects in memory for a (relatively) long time (the length of the request or the length of a large field fetch) means that memory pressure can grow and objects move into longer tenure GC pools. Holding these contexts is also not necessary if the instrumentation never needs to know when a certain execution step finishes. TheInstrumentationContext
is used ot know when an execution step has completed, so instrumentations that do timings say need to use this callback mechanism. Putting such an instrumentation intoNoContextChainedInstrumentation
would be a mistake because no callback will occur. Therefore, use of this class is reserved for very specific us cases. You are fore-warned. This class never holds onto the returnedInstrumentationContext
objects and always returns null as itself.
-
-
Field Summary
-
Fields inherited from class graphql.execution.instrumentation.ChainedInstrumentation
instrumentations
-
-
Constructor Summary
Constructors Constructor Description NoContextChainedInstrumentation(Instrumentation... instrumentations)
NoContextChainedInstrumentation(java.util.List<Instrumentation> instrumentations)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @Nullable ExecuteObjectInstrumentationContext
beginExecuteObject(InstrumentationExecutionStrategyParameters parameters, InstrumentationState state)
This is called each time anExecutionStrategy
object resolution is called, which may be multiple times per query as the engine recursively descends over the query.InstrumentationContext<ExecutionResult>
beginExecuteOperation(InstrumentationExecuteOperationParameters parameters, InstrumentationState state)
This is called just before the execution of the query operation is started.InstrumentationContext<ExecutionResult>
beginExecution(InstrumentationExecutionParameters parameters, InstrumentationState state)
This is called right at the start of query execution, and it's the first step in the instrumentation chain.ExecutionStrategyInstrumentationContext
beginExecutionStrategy(InstrumentationExecutionStrategyParameters parameters, InstrumentationState state)
This is called each time anExecutionStrategy
is invoked, which may be multiple times per query as the engine recursively descends over the query.@Nullable InstrumentationContext<java.lang.Object>
beginFieldCompletion(InstrumentationFieldCompleteParameters parameters, InstrumentationState state)
This is called just before the complete field is started.@Nullable InstrumentationContext<java.lang.Object>
beginFieldExecution(InstrumentationFieldParameters parameters, InstrumentationState state)
This is called just before a field is resolved into a value.InstrumentationContext<java.lang.Object>
beginFieldFetch(InstrumentationFieldFetchParameters parameters, InstrumentationState state)
This is called just before a fieldDataFetcher
is invoked.FieldFetchingInstrumentationContext
beginFieldFetching(InstrumentationFieldFetchParameters parameters, InstrumentationState state)
This is called just before a fieldDataFetcher
is invoked.@Nullable InstrumentationContext<java.lang.Object>
beginFieldListCompletion(InstrumentationFieldCompleteParameters parameters, InstrumentationState state)
This is called just before the complete field list is started.InstrumentationContext<Document>
beginParse(InstrumentationExecutionParameters parameters, InstrumentationState state)
This is called just before a query is parsed.InstrumentationContext<ExecutionResult>
beginSubscribedFieldEvent(InstrumentationFieldParameters parameters, InstrumentationState state)
This is called each time a subscription field produces a new reactive stream event value and it needs to be mapped over via the graphql field subselection.InstrumentationContext<java.util.List<ValidationError>>
beginValidation(InstrumentationValidationParameters parameters, InstrumentationState state)
This is called just before the parsed query document is validated.-
Methods inherited from class graphql.execution.instrumentation.ChainedInstrumentation
beginDeferredField, chainedConsume, chainedMapAndDropNulls, createStateAsync, getInstrumentations, instrumentDataFetcher, instrumentDocumentAndVariables, instrumentExecutionContext, instrumentExecutionInput, instrumentExecutionResult, instrumentSchema
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface graphql.execution.instrumentation.Instrumentation
createState
-
-
-
-
Constructor Detail
-
NoContextChainedInstrumentation
public NoContextChainedInstrumentation(java.util.List<Instrumentation> instrumentations)
-
NoContextChainedInstrumentation
public NoContextChainedInstrumentation(Instrumentation... instrumentations)
-
-
Method Detail
-
beginExecution
public InstrumentationContext<ExecutionResult> beginExecution(InstrumentationExecutionParameters parameters, InstrumentationState state)
Description copied from interface:Instrumentation
This is called right at the start of query execution, and it's the first step in the instrumentation chain.- Specified by:
beginExecution
in interfaceInstrumentation
- Overrides:
beginExecution
in classChainedInstrumentation
- Parameters:
parameters
- the parameters to this stepstate
- the state created during the call toInstrumentation.createStateAsync(InstrumentationCreateStateParameters)
- Returns:
- a nullable
InstrumentationContext
object that will be called back when the step ends (assuming it's not null)
-
beginParse
public InstrumentationContext<Document> beginParse(InstrumentationExecutionParameters parameters, InstrumentationState state)
Description copied from interface:Instrumentation
This is called just before a query is parsed.- Specified by:
beginParse
in interfaceInstrumentation
- Overrides:
beginParse
in classChainedInstrumentation
- Parameters:
parameters
- the parameters to this stepstate
- the state created during the call toInstrumentation.createStateAsync(InstrumentationCreateStateParameters)
- Returns:
- a nullable
InstrumentationContext
object that will be called back when the step ends (assuming it's not null)
-
beginValidation
public InstrumentationContext<java.util.List<ValidationError>> beginValidation(InstrumentationValidationParameters parameters, InstrumentationState state)
Description copied from interface:Instrumentation
This is called just before the parsed query document is validated.- Specified by:
beginValidation
in interfaceInstrumentation
- Overrides:
beginValidation
in classChainedInstrumentation
- Parameters:
parameters
- the parameters to this stepstate
- the state created during the call toInstrumentation.createStateAsync(InstrumentationCreateStateParameters)
- Returns:
- a nullable
InstrumentationContext
object that will be called back when the step ends (assuming it's not null)
-
beginExecuteOperation
public InstrumentationContext<ExecutionResult> beginExecuteOperation(InstrumentationExecuteOperationParameters parameters, InstrumentationState state)
Description copied from interface:Instrumentation
This is called just before the execution of the query operation is started.- Specified by:
beginExecuteOperation
in interfaceInstrumentation
- Overrides:
beginExecuteOperation
in classChainedInstrumentation
- Parameters:
parameters
- the parameters to this stepstate
- the state created during the call toInstrumentation.createStateAsync(InstrumentationCreateStateParameters)
- Returns:
- a nullable
InstrumentationContext
object that will be called back when the step ends (assuming it's not null)
-
beginExecutionStrategy
public ExecutionStrategyInstrumentationContext beginExecutionStrategy(InstrumentationExecutionStrategyParameters parameters, InstrumentationState state)
Description copied from interface:Instrumentation
This is called each time anExecutionStrategy
is invoked, which may be multiple times per query as the engine recursively descends over the query.- Specified by:
beginExecutionStrategy
in interfaceInstrumentation
- Overrides:
beginExecutionStrategy
in classChainedInstrumentation
- Parameters:
parameters
- the parameters to this stepstate
- the state created during the call toInstrumentation.createStateAsync(InstrumentationCreateStateParameters)
- Returns:
- a nullable
ExecutionStrategyInstrumentationContext
object that will be called back when the step ends (assuming it's not null)
-
beginExecuteObject
@Nullable public @Nullable ExecuteObjectInstrumentationContext beginExecuteObject(InstrumentationExecutionStrategyParameters parameters, InstrumentationState state)
Description copied from interface:Instrumentation
This is called each time anExecutionStrategy
object resolution is called, which may be multiple times per query as the engine recursively descends over the query.- Specified by:
beginExecuteObject
in interfaceInstrumentation
- Overrides:
beginExecuteObject
in classChainedInstrumentation
- Parameters:
parameters
- the parameters to this stepstate
- the state created during the call toInstrumentation.createStateAsync(InstrumentationCreateStateParameters)
- Returns:
- a nullable
ExecutionStrategyInstrumentationContext
object that will be called back when the step ends (assuming it's not null)
-
beginSubscribedFieldEvent
public InstrumentationContext<ExecutionResult> beginSubscribedFieldEvent(InstrumentationFieldParameters parameters, InstrumentationState state)
Description copied from interface:Instrumentation
This is called each time a subscription field produces a new reactive stream event value and it needs to be mapped over via the graphql field subselection.- Specified by:
beginSubscribedFieldEvent
in interfaceInstrumentation
- Overrides:
beginSubscribedFieldEvent
in classChainedInstrumentation
- Parameters:
parameters
- the parameters to this stepstate
- the state created during the call toInstrumentation.createStateAsync(InstrumentationCreateStateParameters)
- Returns:
- a nullable
InstrumentationContext
object that will be called back when the step ends (assuming it's not null)
-
beginFieldExecution
@Nullable public @Nullable InstrumentationContext<java.lang.Object> beginFieldExecution(InstrumentationFieldParameters parameters, InstrumentationState state)
Description copied from interface:Instrumentation
This is called just before a field is resolved into a value.- Specified by:
beginFieldExecution
in interfaceInstrumentation
- Overrides:
beginFieldExecution
in classChainedInstrumentation
- Parameters:
parameters
- the parameters to this stepstate
- the state created during the call toInstrumentation.createStateAsync(InstrumentationCreateStateParameters)
- Returns:
- a nullable
InstrumentationContext
object that will be called back when the step ends (assuming it's not null)
-
beginFieldFetch
public InstrumentationContext<java.lang.Object> beginFieldFetch(InstrumentationFieldFetchParameters parameters, InstrumentationState state)
Description copied from interface:Instrumentation
This is called just before a fieldDataFetcher
is invoked.- Specified by:
beginFieldFetch
in interfaceInstrumentation
- Overrides:
beginFieldFetch
in classChainedInstrumentation
- Parameters:
parameters
- the parameters to this stepstate
- the state created during the call toInstrumentation.createStateAsync(InstrumentationCreateStateParameters)
- Returns:
- a nullable
InstrumentationContext
object that will be called back when the step ends (assuming it's not null)
-
beginFieldFetching
public FieldFetchingInstrumentationContext beginFieldFetching(InstrumentationFieldFetchParameters parameters, InstrumentationState state)
Description copied from interface:Instrumentation
This is called just before a fieldDataFetcher
is invoked. TheFieldFetchingInstrumentationContext.onFetchedValue(Object)
callback will be invoked once a value is returned by aDataFetcher
but perhaps before its value is completed if it's aCompletableFuture
value.This method is the replacement method for the now deprecated
Instrumentation.beginFieldFetch(InstrumentationFieldFetchParameters, InstrumentationState)
method, and it should be implemented in newInstrumentation
classes. This default version of this method calls back to the deprecatedInstrumentation.beginFieldFetch(InstrumentationFieldFetchParameters, InstrumentationState)
method so that older implementations continue to work.- Specified by:
beginFieldFetching
in interfaceInstrumentation
- Overrides:
beginFieldFetching
in classChainedInstrumentation
- Parameters:
parameters
- the parameters to this stepstate
- the state created during the call toInstrumentation.createStateAsync(InstrumentationCreateStateParameters)
- Returns:
- a nullable
InstrumentationContext
object that will be called back when the step ends (assuming it's not null)
-
beginFieldCompletion
@Nullable public @Nullable InstrumentationContext<java.lang.Object> beginFieldCompletion(InstrumentationFieldCompleteParameters parameters, InstrumentationState state)
Description copied from interface:Instrumentation
This is called just before the complete field is started.- Specified by:
beginFieldCompletion
in interfaceInstrumentation
- Overrides:
beginFieldCompletion
in classChainedInstrumentation
- Parameters:
parameters
- the parameters to this stepstate
- the state created during the call toInstrumentation.createStateAsync(InstrumentationCreateStateParameters)
- Returns:
- a nullable
InstrumentationContext
object that will be called back when the step ends (assuming it's not null)
-
beginFieldListCompletion
@Nullable public @Nullable InstrumentationContext<java.lang.Object> beginFieldListCompletion(InstrumentationFieldCompleteParameters parameters, InstrumentationState state)
Description copied from interface:Instrumentation
This is called just before the complete field list is started.- Specified by:
beginFieldListCompletion
in interfaceInstrumentation
- Overrides:
beginFieldListCompletion
in classChainedInstrumentation
- Parameters:
parameters
- the parameters to this stepstate
- the state created during the call toInstrumentation.createStateAsync(InstrumentationCreateStateParameters)
- Returns:
- a nullable
InstrumentationContext
object that will be called back when the step ends (assuming it's not null)
-
-