Sha256: f96d16d9361370531513537bf38fc5c33e903492e46559d4e14820245f9fae85

Contents?: true

Size: 704 Bytes

Versions: 11

Compression:

Stored size: 704 Bytes

Contents

require 'ddtrace/contrib/patcher'
require 'ddtrace/contrib/mysql2/client'

module Datadog
  module Contrib
    module Mysql2
      # Patcher enables patching of 'mysql2' module.
      module Patcher
        include Contrib::Patcher

        module_function

        def patched?
          done?(:mysql2)
        end

        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

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

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
ddtrace-0.20.0 lib/ddtrace/contrib/mysql2/patcher.rb
ddtrace-0.19.1 lib/ddtrace/contrib/mysql2/patcher.rb
ddtrace-0.19.0 lib/ddtrace/contrib/mysql2/patcher.rb
ddtrace-0.18.3 lib/ddtrace/contrib/mysql2/patcher.rb
ddtrace-0.18.2 lib/ddtrace/contrib/mysql2/patcher.rb
ddtrace-0.18.1 lib/ddtrace/contrib/mysql2/patcher.rb
ddtrace-0.18.0 lib/ddtrace/contrib/mysql2/patcher.rb
ddtrace-0.17.3 lib/ddtrace/contrib/mysql2/patcher.rb
ddtrace-0.17.2 lib/ddtrace/contrib/mysql2/patcher.rb
ddtrace-0.17.1 lib/ddtrace/contrib/mysql2/patcher.rb
ddtrace-0.17.0 lib/ddtrace/contrib/mysql2/patcher.rb