Module: ApolloStudioTracing
- Extended by:
- ApolloStudioTracing
- Included in:
- ApolloStudioTracing
- Defined in:
- lib/apollo-studio-tracing/tracer.rb,
lib/apollo-studio-tracing.rb,
lib/apollo-studio-tracing/api.rb,
lib/apollo-studio-tracing/proto.rb,
lib/apollo-studio-tracing/logger.rb,
lib/apollo-studio-tracing/version.rb,
lib/apollo-studio-tracing/node_map.rb,
lib/apollo-studio-tracing/trace_channel.rb,
lib/apollo-studio-tracing/shutdown_barrier.rb
Overview
Trace events are nested and fire in this order for a simple single-field query like ‘{ foo }`:
<execute_multiplex>
<lex></lex>
<parse></parse>
<validate></validate>
<analyze_multiplex>
<analyze_query></analyze_query>
</analyze_multiplex>
<execute_query>
<execute_field></execute_field>
</execute_query>
<execute_query_lazy>
# `execute_field_lazy` fires *only* when the field is lazy
# (https://graphql-ruby.org/schema/lazy_execution.html)
# so if it fires we should overwrite the ending times recorded
# in `execute_field` to capture the total execution time.
<execute_field_lazy></execute_field_lazy>
</execute_query_lazy>
# `execute_query_lazy` *always* fires, so it's a
# safe place to capture ending times of the full query.
</execute_multiplex>
Defined Under Namespace
Modules: API Classes: ApolloLogger, NodeMap, ShutdownBarrier, TraceChannel, Tracer
Constant Summary collapse
- KEY =
:apollo_trace
- DEBUG_KEY =
"#{KEY}_debug".to_sym
- Trace =
::Mdg::Engine::Proto::Trace
- TracesAndStats =
::Mdg::Engine::Proto::TracesAndStats
- Node =
::Mdg::Engine::Proto::Trace::Node
- Location =
::Mdg::Engine::Proto::Trace::Location
- Error =
::Mdg::Engine::Proto::Trace::Error
- ReportHeader =
::Mdg::Engine::Proto::ReportHeader
- Report =
::Mdg::Engine::Proto::Report
- VERSION =
'1.1.0'
Instance Attribute Summary collapse
-
#logger ⇒ Object
Returns the value of attribute logger.
Instance Method Summary collapse
Instance Attribute Details
#logger ⇒ Object
Returns the value of attribute logger.
14 15 16 |
# File 'lib/apollo-studio-tracing.rb', line 14 def logger @logger end |
Instance Method Details
#flush ⇒ Object
30 31 32 |
# File 'lib/apollo-studio-tracing.rb', line 30 def flush tracers.each(&:flush_trace_channel) end |
#shutdown ⇒ Object
34 35 36 |
# File 'lib/apollo-studio-tracing.rb', line 34 def shutdown tracers.each(&:shutdown_trace_channel) end |
#use(schema, enabled: true, **options) ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/apollo-studio-tracing.rb', line 19 def use(schema, enabled: true, **) return unless enabled tracer = ApolloStudioTracing::Tracer.new(**) # TODO: Shutdown tracers when reloading code in Rails # (although it's unlikely you'll have Apollo Tracing enabled in development) tracers << tracer schema.tracer(tracer) tracer.start_trace_channel end |