Module: SignalFx::Tracing::Instrumenter::ActiveRecord

Defined in:
lib/signalfx/tracing/instrumentation/active_record.rb

Class Method Summary collapse

Class Method Details

.instrument(opts = {}) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/signalfx/tracing/instrumentation/active_record.rb', line 10

def instrument(opts = {})
  # load ActiveRecord and ActiveSupport if present
  begin
    require 'active_support'
    require 'active_record'
  rescue LoadError
    return
  end

  begin
    require 'active_record/opentracing'
  rescue LoadError => e
    puts e.message
    return
  end
  ::ActiveRecord::OpenTracing.instrument if !@instrumented
  @instrumented = true
end