Class TracingSupport
- java.lang.Object
-
- graphql.execution.instrumentation.tracing.TracingSupport
-
- All Implemented Interfaces:
InstrumentationState
@PublicApi public class TracingSupport extends java.lang.Object implements InstrumentationState
This creates a map of tracing information as outlined in https://github.com/apollographql/apollo-tracingThis 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 Classes Modifier and Type Class Description static interface
TracingSupport.TracingContext
A simple object that you need to callTracingSupport.TracingContext.onEnd()
on
-
Constructor Summary
Constructors Constructor Description TracingSupport(boolean includeTrivialDataFetchers)
The timer starts as soon as you create this object
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.TracingSupport.TracingContext
beginParse()
This should be called to start the trace of query parsing, withTracingSupport.TracingContext.onEnd()
being called to end the call.TracingSupport.TracingContext
beginValidation()
This should be called to start the trace of query validation, withTracingSupport.TracingContext.onEnd()
being called to end the call.java.util.Map<java.lang.String,java.lang.Object>
snapshotTracingData()
This will snapshot this tracing and return a map of the results
-
-
-
Method Detail
-
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
public TracingSupport.TracingContext 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
public TracingSupport.TracingContext 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
public java.util.Map<java.lang.String,java.lang.Object> snapshotTracingData()
This will snapshot this tracing and return a map of the results- Returns:
- a snapshot of the tracing data
-
-