Class: GraphQL::Tracing::Trace
- Inherits:
-
Object
- Object
- GraphQL::Tracing::Trace
- Defined in:
- lib/graphql/tracing/trace.rb
Overview
This is the base class for a trace
instance whose methods are called during query execution.
“Trace modes” are subclasses of this with custom tracing modules mixed in.
A trace module may implement any of the methods on Trace
, being sure to call super
to continue any tracing hooks and call the actual runtime behavior.
Direct Known Subclasses
Instance Method Summary collapse
-
#analyze_multiplex(multiplex:) ⇒ void
-
#analyze_query(query:) ⇒ Object
-
#authorized(query:, type:, object:) ⇒ Object
-
#authorized_lazy(query:, type:, object:) ⇒ Object
-
#begin_analyze_multiplex(multiplex, analyzers) ⇒ void
-
#begin_authorized(type, object, context) ⇒ void
A call to
.authorized?
is starting. -
#begin_dataloader(dataloader) ⇒ void
A dataloader run is starting.
-
#begin_dataloader_source(source) ⇒ void
A source with pending keys is about to fetch.
-
#begin_execute_field(field, object, arguments, query) ⇒ Object
GraphQL is about to resolve this field.
-
#begin_resolve_type(type, value, context) ⇒ void
A call to
.resolve_type
is starting. -
#begin_validate(query, validate) ⇒ Object
-
#dataloader_fiber_exit ⇒ void
Called when an execution or source fiber terminates.
-
#dataloader_fiber_resume(source) ⇒ void
Called when a Dataloader fiber is resumed because data has been loaded.
-
#dataloader_fiber_yield(source) ⇒ void
Called when a Dataloader fiber is paused to wait for data.
-
#dataloader_spawn_execution_fiber(jobs) ⇒ void
Called when Dataloader spins up a new fiber for GraphQL execution.
-
#dataloader_spawn_source_fiber(pending_sources) ⇒ void
Called when Dataloader spins up a new fiber for fetching data.
-
#end_analyze_multiplex(multiplex, analyzers) ⇒ void
-
#end_authorized(type, object, context, authorized_result) ⇒ void
A call to
.authorized?
just finished. -
#end_dataloader(dataloader) ⇒ void
A dataloader run has ended.
-
#end_dataloader_source(source) ⇒ void
A fetch call has just ended.
-
#end_execute_field(field, object, arguments, query, result) ⇒ Object
GraphQL just finished resolving this field.
-
#end_resolve_type(type, value, context, resolved_type) ⇒ void
A call to
.resolve_type
just ended. -
#end_validate(query, validate, errors) ⇒ Object
-
#execute_field(field:, query:, ast_node:, arguments:, object:) ⇒ Object
-
#execute_field_lazy(field:, query:, ast_node:, arguments:, object:) ⇒ Object
-
#execute_multiplex(multiplex:) ⇒ void
This wraps an entire
.execute
call. -
#execute_query(query:) ⇒ Object
-
#execute_query_lazy(query:, multiplex:) ⇒ Object
-
#initialize(multiplex: nil, query: nil, **_options) ⇒ Trace
constructor
A new instance of Trace.
-
#lex(query_string:) ⇒ Object
The Ruby parser doesn’t call this method (
graphql/c_parser
does.). -
#parse(query_string:) ⇒ void
-
#resolve_type(query:, type:, object:) ⇒ Object
-
#resolve_type_lazy(query:, type:, object:) ⇒ Object
-
#validate(query:, validate:) ⇒ Object
Constructor Details
#initialize(multiplex: nil, query: nil, **_options) ⇒ Trace
Returns a new instance of Trace.
16 17 18 19 |
# File 'lib/graphql/tracing/trace.rb', line 16 def initialize(multiplex: nil, query: nil, **) @multiplex = multiplex @query = query end |
Instance Method Details
#analyze_multiplex(multiplex:) ⇒ void
This method returns an undefined value.
52 53 54 |
# File 'lib/graphql/tracing/trace.rb', line 52 def analyze_multiplex(multiplex:) yield end |
#analyze_query(query:) ⇒ Object
56 57 58 |
# File 'lib/graphql/tracing/trace.rb', line 56 def analyze_query(query:) yield end |
#authorized(query:, type:, object:) ⇒ Object
97 98 99 |
# File 'lib/graphql/tracing/trace.rb', line 97 def (query:, type:, object:) yield end |
#authorized_lazy(query:, type:, object:) ⇒ Object
117 118 119 |
# File 'lib/graphql/tracing/trace.rb', line 117 def (query:, type:, object:) yield end |
#begin_analyze_multiplex(multiplex, analyzers) ⇒ void
This method returns an undefined value.
45 |
# File 'lib/graphql/tracing/trace.rb', line 45 def begin_analyze_multiplex(multiplex, analyzers); end |
#begin_authorized(type, object, context) ⇒ void
This method returns an undefined value.
A call to .authorized?
is starting
106 107 |
# File 'lib/graphql/tracing/trace.rb', line 106 def (type, object, context) end |
#begin_dataloader(dataloader) ⇒ void
This method returns an undefined value.
A dataloader run is starting
149 |
# File 'lib/graphql/tracing/trace.rb', line 149 def begin_dataloader(dataloader); end |
#begin_dataloader_source(source) ⇒ void
This method returns an undefined value.
A source with pending keys is about to fetch
158 |
# File 'lib/graphql/tracing/trace.rb', line 158 def begin_dataloader_source(source); end |
#begin_execute_field(field, object, arguments, query) ⇒ Object
GraphQL is about to resolve this field
80 |
# File 'lib/graphql/tracing/trace.rb', line 80 def begin_execute_field(field, object, arguments, query); end |
#begin_resolve_type(type, value, context) ⇒ void
This method returns an undefined value.
A call to .resolve_type
is starting
134 135 |
# File 'lib/graphql/tracing/trace.rb', line 134 def begin_resolve_type(type, value, context) end |
#begin_validate(query, validate) ⇒ Object
36 37 |
# File 'lib/graphql/tracing/trace.rb', line 36 def begin_validate(query, validate) end |
#dataloader_fiber_exit ⇒ void
This method returns an undefined value.
Called when an execution or source fiber terminates
174 |
# File 'lib/graphql/tracing/trace.rb', line 174 def dataloader_fiber_exit; end |
#dataloader_fiber_resume(source) ⇒ void
This method returns an undefined value.
Called when a Dataloader fiber is resumed because data has been loaded
183 |
# File 'lib/graphql/tracing/trace.rb', line 183 def dataloader_fiber_resume(source); end |
#dataloader_fiber_yield(source) ⇒ void
This method returns an undefined value.
Called when a Dataloader fiber is paused to wait for data
179 |
# File 'lib/graphql/tracing/trace.rb', line 179 def dataloader_fiber_yield(source); end |
#dataloader_spawn_execution_fiber(jobs) ⇒ void
This method returns an undefined value.
Called when Dataloader spins up a new fiber for GraphQL execution
167 |
# File 'lib/graphql/tracing/trace.rb', line 167 def dataloader_spawn_execution_fiber(jobs); end |
#dataloader_spawn_source_fiber(pending_sources) ⇒ void
This method returns an undefined value.
Called when Dataloader spins up a new fiber for fetching data
171 |
# File 'lib/graphql/tracing/trace.rb', line 171 def dataloader_spawn_source_fiber(pending_sources); end |
#end_analyze_multiplex(multiplex, analyzers) ⇒ void
This method returns an undefined value.
49 |
# File 'lib/graphql/tracing/trace.rb', line 49 def end_analyze_multiplex(multiplex, analyzers); end |
#end_authorized(type, object, context, authorized_result) ⇒ void
This method returns an undefined value.
A call to .authorized?
just finished
114 115 |
# File 'lib/graphql/tracing/trace.rb', line 114 def (type, object, context, ) end |
#end_dataloader(dataloader) ⇒ void
This method returns an undefined value.
A dataloader run has ended
153 |
# File 'lib/graphql/tracing/trace.rb', line 153 def end_dataloader(dataloader); end |
#end_dataloader_source(source) ⇒ void
This method returns an undefined value.
A fetch call has just ended
162 |
# File 'lib/graphql/tracing/trace.rb', line 162 def end_dataloader_source(source); end |
#end_execute_field(field, object, arguments, query, result) ⇒ Object
GraphQL just finished resolving this field
87 |
# File 'lib/graphql/tracing/trace.rb', line 87 def end_execute_field(field, object, arguments, query, result); end |
#end_resolve_type(type, value, context, resolved_type) ⇒ void
This method returns an undefined value.
A call to .resolve_type
just ended
143 144 |
# File 'lib/graphql/tracing/trace.rb', line 143 def end_resolve_type(type, value, context, resolved_type) end |
#end_validate(query, validate, errors) ⇒ Object
39 40 |
# File 'lib/graphql/tracing/trace.rb', line 39 def end_validate(query, validate, errors) end |
#execute_field(field:, query:, ast_node:, arguments:, object:) ⇒ Object
89 90 91 |
# File 'lib/graphql/tracing/trace.rb', line 89 def execute_field(field:, query:, ast_node:, arguments:, object:) yield end |
#execute_field_lazy(field:, query:, ast_node:, arguments:, object:) ⇒ Object
93 94 95 |
# File 'lib/graphql/tracing/trace.rb', line 93 def execute_field_lazy(field:, query:, ast_node:, arguments:, object:) yield end |
#execute_multiplex(multiplex:) ⇒ void
This method returns an undefined value.
This wraps an entire .execute
call.
63 64 65 |
# File 'lib/graphql/tracing/trace.rb', line 63 def execute_multiplex(multiplex:) yield end |
#execute_query(query:) ⇒ Object
67 68 69 |
# File 'lib/graphql/tracing/trace.rb', line 67 def execute_query(query:) yield end |
#execute_query_lazy(query:, multiplex:) ⇒ Object
71 72 73 |
# File 'lib/graphql/tracing/trace.rb', line 71 def execute_query_lazy(query:, multiplex:) yield end |
#lex(query_string:) ⇒ Object
The Ruby parser doesn’t call this method (graphql/c_parser
does.)
22 23 24 |
# File 'lib/graphql/tracing/trace.rb', line 22 def lex(query_string:) yield end |
#parse(query_string:) ⇒ void
This method returns an undefined value.
28 29 30 |
# File 'lib/graphql/tracing/trace.rb', line 28 def parse(query_string:) yield end |
#resolve_type(query:, type:, object:) ⇒ Object
121 122 123 |
# File 'lib/graphql/tracing/trace.rb', line 121 def resolve_type(query:, type:, object:) yield end |
#resolve_type_lazy(query:, type:, object:) ⇒ Object
125 126 127 |
# File 'lib/graphql/tracing/trace.rb', line 125 def resolve_type_lazy(query:, type:, object:) yield end |
#validate(query:, validate:) ⇒ Object
32 33 34 |
# File 'lib/graphql/tracing/trace.rb', line 32 def validate(query:, validate:) yield end |