@PublicApi public class NoContextChainedInstrumentation extends ChainedInstrumentation
ChainedInstrumentation
will call a list of Instrumentation
s
but it will never back on the returned InstrumentationContext
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 the ChainedInstrumentation
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 the InstrumentationContext
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.
The InstrumentationContext
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 into NoContextChainedInstrumentation
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 returned InstrumentationContext
objects and always returns null
as itself.instrumentations
Constructor and Description |
---|
NoContextChainedInstrumentation(Instrumentation... instrumentations) |
NoContextChainedInstrumentation(java.util.List<Instrumentation> instrumentations) |
Modifier and Type | Method and Description |
---|---|
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 an
ExecutionStrategy is invoked, which may be multiple times
per query as the engine recursively descends down over the query. |
InstrumentationContext<ExecutionResult> |
beginField(InstrumentationFieldParameters parameters,
InstrumentationState state)
This is called just before a field is resolved into a value.
|
InstrumentationContext<ExecutionResult> |
beginFieldComplete(InstrumentationFieldCompleteParameters parameters,
InstrumentationState state)
This is called just before the complete field is started.
|
InstrumentationContext<java.lang.Object> |
beginFieldFetch(InstrumentationFieldFetchParameters parameters,
InstrumentationState state)
This is called just before a field
DataFetcher is invoked. |
InstrumentationContext<ExecutionResult> |
beginFieldListComplete(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.
|
beginExecuteOperation, beginExecution, beginExecutionStrategy, beginField, beginFieldComplete, beginFieldFetch, beginFieldListComplete, beginParse, beginSubscribedFieldEvent, beginValidation, createState, getInstrumentations, getSpecificState, instrumentDataFetcher, instrumentDataFetcher, instrumentDocumentAndVariables, instrumentDocumentAndVariables, instrumentExecutionContext, instrumentExecutionContext, instrumentExecutionInput, instrumentExecutionInput, instrumentExecutionResult, instrumentExecutionResult, instrumentSchema, instrumentSchema
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createState
public NoContextChainedInstrumentation(java.util.List<Instrumentation> instrumentations)
public NoContextChainedInstrumentation(Instrumentation... instrumentations)
public InstrumentationContext<ExecutionResult> beginExecution(InstrumentationExecutionParameters parameters, InstrumentationState state)
Instrumentation
beginExecution
in interface Instrumentation
beginExecution
in class ChainedInstrumentation
parameters
- the parameters to this stepstate
- 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)public InstrumentationContext<Document> beginParse(InstrumentationExecutionParameters parameters, InstrumentationState state)
Instrumentation
beginParse
in interface Instrumentation
beginParse
in class ChainedInstrumentation
parameters
- the parameters to this stepstate
- 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)public InstrumentationContext<java.util.List<ValidationError>> beginValidation(InstrumentationValidationParameters parameters, InstrumentationState state)
Instrumentation
beginValidation
in interface Instrumentation
beginValidation
in class ChainedInstrumentation
parameters
- the parameters to this stepstate
- 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)public InstrumentationContext<ExecutionResult> beginExecuteOperation(InstrumentationExecuteOperationParameters parameters, InstrumentationState state)
Instrumentation
beginExecuteOperation
in interface Instrumentation
beginExecuteOperation
in class ChainedInstrumentation
parameters
- the parameters to this stepstate
- 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)public ExecutionStrategyInstrumentationContext beginExecutionStrategy(InstrumentationExecutionStrategyParameters parameters, InstrumentationState state)
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 ChainedInstrumentation
parameters
- the parameters to this stepstate
- 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)public InstrumentationContext<ExecutionResult> beginSubscribedFieldEvent(InstrumentationFieldParameters parameters, InstrumentationState state)
Instrumentation
beginSubscribedFieldEvent
in interface Instrumentation
beginSubscribedFieldEvent
in class ChainedInstrumentation
parameters
- the parameters to this stepstate
- 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)public InstrumentationContext<ExecutionResult> beginField(InstrumentationFieldParameters parameters, InstrumentationState state)
Instrumentation
beginField
in interface Instrumentation
beginField
in class ChainedInstrumentation
parameters
- the parameters to this stepstate
- 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)public InstrumentationContext<java.lang.Object> beginFieldFetch(InstrumentationFieldFetchParameters parameters, InstrumentationState state)
Instrumentation
DataFetcher
is invoked.beginFieldFetch
in interface Instrumentation
beginFieldFetch
in class ChainedInstrumentation
parameters
- the parameters to this stepstate
- 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)public InstrumentationContext<ExecutionResult> beginFieldComplete(InstrumentationFieldCompleteParameters parameters, InstrumentationState state)
Instrumentation
beginFieldComplete
in interface Instrumentation
beginFieldComplete
in class ChainedInstrumentation
parameters
- the parameters to this stepstate
- 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)public InstrumentationContext<ExecutionResult> beginFieldListComplete(InstrumentationFieldCompleteParameters parameters, InstrumentationState state)
Instrumentation
beginFieldListComplete
in interface Instrumentation
beginFieldListComplete
in class ChainedInstrumentation
parameters
- the parameters to this stepstate
- 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)