Module: BrainzLab::Instrumentation::GraphQLInstrumentation

Defined in:
lib/brainzlab/instrumentation/graphql.rb

Defined Under Namespace

Modules: Tracer

Class Method Summary collapse

Class Method Details

.install!Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/brainzlab/instrumentation/graphql.rb', line 9

def install!
  return unless defined?(::GraphQL::Schema)
  return if @installed

  # For GraphQL Ruby 2.0+
  if ::GraphQL::Schema.respond_to?(:trace_with)
    # Will be installed per-schema via BrainzLab::GraphQL::Tracer
    BrainzLab.debug_log('GraphQL tracer available - add `trace_with BrainzLab::Instrumentation::GraphQLInstrumentation::Tracer` to your schema')
  end

  # Subscribe to ActiveSupport notifications if available
  install_notifications!

  @installed = true
  BrainzLab.debug_log('GraphQL instrumentation installed')
end

.installed?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/brainzlab/instrumentation/graphql.rb', line 26

def installed?
  @installed
end

.reset!Object



30
31
32
# File 'lib/brainzlab/instrumentation/graphql.rb', line 30

def reset!
  @installed = false
end