Module: Datadog::Contrib::Mysql2::Patcher

Includes:
Patcher
Defined in:
lib/ddtrace/contrib/mysql2/patcher.rb

Overview

Patcher enables patching of ‘mysql2’ module.

Class Method Summary collapse

Methods included from Patcher

included

Class Method Details

.patchObject



17
18
19
20
21
22
23
24
25
# File 'lib/ddtrace/contrib/mysql2/patcher.rb', line 17

def patch
  do_once(:mysql2) do
    begin
      patch_mysql2_client
    rescue StandardError => e
      Datadog::Tracer.log.error("Unable to apply mysql2 integration: #{e}")
    end
  end
end

.patch_mysql2_clientObject



27
28
29
# File 'lib/ddtrace/contrib/mysql2/patcher.rb', line 27

def patch_mysql2_client
  ::Mysql2::Client.send(:include, Instrumentation)
end

.patched?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/ddtrace/contrib/mysql2/patcher.rb', line 13

def patched?
  done?(:mysql2)
end