Module: GraphQL::Tracing::Traceable

Included in:
Execution::Multiplex, Query
Defined in:
lib/graphql/tracing.rb

Overview

Objects may include traceable to gain a .trace(...) method. The object must have a @tracers ivar of type Array<<#trace(k, d, &b)>>.

Instance Method Summary collapse

Instance Method Details

#trace(key, metadata, &block) ⇒ Object

Parameters

  • key (String) — The name of the event in GraphQL internals
  • metadata (Hash) — Event-related metadata (can be anything)

Returns

  • Object — Must return the value of the block

:call-seq:

trace(String key, Hash metadata, &block) -> Object


54
55
56
57
# File 'lib/graphql/tracing.rb', line 54

def trace(key, , &block)
  return yield if @tracers.empty?
  call_tracers(0, key, , &block)
end