Class GraphQlObservationInstrumentation
java.lang.Object
graphql.execution.instrumentation.SimplePerformantInstrumentation
org.springframework.graphql.observation.GraphQlObservationInstrumentation
- All Implemented Interfaces:
Instrumentation
Instrumentation
that creates
observations
for GraphQL requests and data fetcher operations.
GraphQL request instrumentation measures the execution time of requests
and collects information from the ExecutionRequestObservationContext
.
A request can perform many data fetching operations.
The configured ExecutionRequestObservationConvention
will be used,
or the DefaultExecutionRequestObservationConvention
if none was provided.
GraphQL data fetcher instrumentation measures the execution time of
a data fetching operation in the context of the current request.
Information is collected from the DataFetcherObservationContext
.
The configured DataFetcherObservationConvention
will be used,
or the DefaultDataFetcherObservationConvention
if none was provided.
- Since:
- 1.1.0
- Author:
- Brian Clozel
-
Field Summary
Fields inherited from class graphql.execution.instrumentation.SimplePerformantInstrumentation
INSTANCE
-
Constructor Summary
ConstructorDescriptionGraphQlObservationInstrumentation
(io.micrometer.observation.ObservationRegistry observationRegistry) Create anGraphQlObservationInstrumentation
that records observations against the givenObservationRegistry
.GraphQlObservationInstrumentation
(io.micrometer.observation.ObservationRegistry observationRegistry, ExecutionRequestObservationConvention requestObservationConvention, DataFetcherObservationConvention dateFetcherObservationConvention) Create anGraphQlObservationInstrumentation
that records observations against the givenObservationRegistry
with a custom convention. -
Method Summary
Modifier and TypeMethodDescriptionbeginExecution
(InstrumentationExecutionParameters parameters, InstrumentationState state) createStateAsync
(InstrumentationCreateStateParameters parameters) DataFetcher<?>
instrumentDataFetcher
(DataFetcher<?> dataFetcher, InstrumentationFieldFetchParameters parameters, InstrumentationState state) Methods inherited from class graphql.execution.instrumentation.SimplePerformantInstrumentation
beginExecuteObject, beginExecuteOperation, beginExecutionStrategy, beginFieldCompletion, beginFieldExecution, beginFieldFetch, beginFieldListCompletion, beginParse, beginSubscribedFieldEvent, beginValidation, createState, 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
beginDeferredField, beginFieldFetching
-
Constructor Details
-
GraphQlObservationInstrumentation
public GraphQlObservationInstrumentation(io.micrometer.observation.ObservationRegistry observationRegistry) Create anGraphQlObservationInstrumentation
that records observations against the givenObservationRegistry
. The default observation conventions will be used.- Parameters:
observationRegistry
- the registry to use for recording observations
-
GraphQlObservationInstrumentation
public GraphQlObservationInstrumentation(io.micrometer.observation.ObservationRegistry observationRegistry, @Nullable ExecutionRequestObservationConvention requestObservationConvention, @Nullable DataFetcherObservationConvention dateFetcherObservationConvention) Create anGraphQlObservationInstrumentation
that records observations against the givenObservationRegistry
with a custom convention.- Parameters:
observationRegistry
- the registry to use for recording observationsrequestObservationConvention
- the convention to use for request observationsdateFetcherObservationConvention
- the convention to use for data fetcher observations
-
-
Method Details
-
createStateAsync
public CompletableFuture<InstrumentationState> createStateAsync(InstrumentationCreateStateParameters parameters) - Specified by:
createStateAsync
in interfaceInstrumentation
- Overrides:
createStateAsync
in classSimplePerformantInstrumentation
-
beginExecution
public InstrumentationContext<ExecutionResult> beginExecution(InstrumentationExecutionParameters parameters, InstrumentationState state) - Specified by:
beginExecution
in interfaceInstrumentation
- Overrides:
beginExecution
in classSimplePerformantInstrumentation
-
instrumentDataFetcher
public DataFetcher<?> instrumentDataFetcher(DataFetcher<?> dataFetcher, InstrumentationFieldFetchParameters parameters, InstrumentationState state) - Specified by:
instrumentDataFetcher
in interfaceInstrumentation
- Overrides:
instrumentDataFetcher
in classSimplePerformantInstrumentation
-