Class: GraphQL::Tracing::Trace

Inherits:
Object
  • Object
show all
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

LegacyTrace

Instance Method Summary collapse

Constructor Details

#initialize(multiplex: nil, query: nil, **_options) ⇒ Trace

Returns a new instance of Trace.

Parameters:



16
17
18
19
# File 'lib/graphql/tracing/trace.rb', line 16

def initialize(multiplex: nil, query: nil, **_options)
  @multiplex = multiplex
  @query = query
end

Instance Method Details

#analyze_multiplex(multiplex:) ⇒ void

This method returns an undefined value.

Parameters:



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 authorized(query:, type:, object:)
  yield
end

#authorized_lazy(query:, type:, object:) ⇒ Object



117
118
119
# File 'lib/graphql/tracing/trace.rb', line 117

def authorized_lazy(query:, type:, object:)
  yield
end

#begin_analyze_multiplex(multiplex, analyzers) ⇒ void

This method returns an undefined value.

Parameters:



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

Parameters:



106
107
# File 'lib/graphql/tracing/trace.rb', line 106

def begin_authorized(type, object, context)
end

#begin_dataloader(dataloader) ⇒ void

This method returns an undefined value.

A dataloader run is starting

Parameters:



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

Parameters:



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

Parameters:



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

Parameters:



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_exitvoid

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

Parameters:



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

Parameters:



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

Parameters:

  • jobs (Array<#call>)

    Execution steps to run



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

Parameters:



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.

Parameters:



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

Parameters:



114
115
# File 'lib/graphql/tracing/trace.rb', line 114

def end_authorized(type, object, context, authorized_result)
end

#end_dataloader(dataloader) ⇒ void

This method returns an undefined value.

A dataloader run has ended

Parameters:



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

Parameters:



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

Parameters:



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

Parameters:



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.

Parameters:



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.

Parameters:

  • query_string (String)


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