Class TracingSupport
java.lang.Object
graphql.execution.instrumentation.tracing.TracingSupport
- All Implemented Interfaces:
InstrumentationState
This creates a map of tracing information as outlined in http://github.com/apollographql/apollo-tracing
This is a stateful object that should be instantiated and called via Instrumentation
calls. It has been made a separate class so that you can compose this into existing
instrumentation code.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
A simple object that you need to callTracingSupport.TracingContext.onEnd()
on -
Constructor Summary
ConstructorsConstructorDescriptionTracingSupport
(boolean includeTrivialDataFetchers) The timer starts as soon as you create this object -
Method Summary
Modifier and TypeMethodDescriptionbeginField
(DataFetchingEnvironment dataFetchingEnvironment, boolean trivialDataFetcher) This should be called to start the trace of a field, withTracingSupport.TracingContext.onEnd()
being called to end the call.This should be called to start the trace of query parsing, withTracingSupport.TracingContext.onEnd()
being called to end the call.This should be called to start the trace of query validation, withTracingSupport.TracingContext.onEnd()
being called to end the call.This will snapshot this tracing and return a map of the results
-
Constructor Details
-
TracingSupport
public TracingSupport(boolean includeTrivialDataFetchers) The timer starts as soon as you create this object- Parameters:
includeTrivialDataFetchers
- whether the trace trivial data fetchers
-
-
Method Details
-
beginField
public TracingSupport.TracingContext beginField(DataFetchingEnvironment dataFetchingEnvironment, boolean trivialDataFetcher) This should be called to start the trace of a field, withTracingSupport.TracingContext.onEnd()
being called to end the call.- Parameters:
dataFetchingEnvironment
- the data fetching that is occurringtrivialDataFetcher
- if the data fetcher is considered trivial- Returns:
- a context to call end on
-
beginParse
This should be called to start the trace of query parsing, withTracingSupport.TracingContext.onEnd()
being called to end the call.- Returns:
- a context to call end on
-
beginValidation
This should be called to start the trace of query validation, withTracingSupport.TracingContext.onEnd()
being called to end the call.- Returns:
- a context to call end on
-
snapshotTracingData
This will snapshot this tracing and return a map of the results- Returns:
- a snapshot of the tracing data
-