Module: OpticsAgent::GraphQLSchemaExtensions

Included in:
GraphQL::Schema
Defined in:
lib/optics-agent/instrumenters/patch-graphql-schema.rb

Instance Method Summary collapse

Instance Method Details

#define(**kwargs, &block) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/optics-agent/instrumenters/patch-graphql-schema.rb', line 9

def define(**kwargs, &block)
  @instrumenter = OpticsAgent::Instrumenters::Field.new

  class << self
    def _attach_optics_agent(agent)
      agent.debug "Attaching agent to field instrumenter"
      @instrumenter.agent = agent
    end
  end

  instrumenter = @instrumenter
  super **kwargs do
    instance_eval(&block) if block
    instrument :field, instrumenter
  end
end