Module: Oboe::API::LayerInit

Defined in:
lib/oboe/api/layerinit.rb

Overview

Provides methods related to layer initialization and reporting

Instance Method Summary collapse

Instance Method Details

#force_traceObject

force_trace has been deprecated and will be removed in a subsequent version.



27
28
29
30
31
32
33
34
35
36
# File 'lib/oboe/api/layerinit.rb', line 27

def force_trace
  Oboe.logger.warn 'Oboe::API::LayerInit.force_trace has been deprecated and will be ' \
                   'removed in a subsequent version.'

  saved_mode = Oboe::Config[:tracing_mode]
  Oboe::Config[:tracing_mode] = 'always'
  yield
ensure
  Oboe::Config[:tracing_mode] = saved_mode
end

#report_init(layer = 'rack') ⇒ Object

Internal: Report that instrumentation for the given layer has been installed, as well as the version of instrumentation and version of layer.



13
14
15
16
17
18
19
20
21
22
# File 'lib/oboe/api/layerinit.rb', line 13

def report_init(layer = 'rack')
  # Don't send __Init in development or test
  return if %w(development test).include? ENV['RACK_ENV']

  # Don't send __Init if the c-extension hasn't loaded
  return unless Oboe.loaded

  platform_info = Oboe::Util.build_init_report
  start_trace(layer, nil, platform_info.merge('Force' => true)) {}
end