Module: SignalFx::Tracing::Instrumenter::Mysql2

Defined in:
lib/signalfx/tracing/instrumentation/mysql2.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
# File 'lib/signalfx/tracing/instrumentation/mysql2.rb', line 10

def instrument(opts = {})
  begin
    require 'mysql2'
  rescue LoadError
    return
  end

  begin
    require 'mysql2/instrumentation'
  rescue LoadError => e
    puts e.message
    return
  end

  ::Mysql2::Instrumentation.instrument(tracer: SignalFx::Tracing::Instrumenter.tracer) if !@instrumented
  @instrumented = true
end