Sha256: 89c77132f27aff1f6afa866b8a13b51d5d55cc472a27e4b64fcdceab0846feeb

Contents?: true

Size: 1.19 KB

Versions: 6

Compression:

Stored size: 1.19 KB

Contents

# Copyright (c) 2016 SolarWinds, LLC.
# All rights reserved.

module AppOpticsAPM
  module Inst
    module ConnectionAdapters
      module FlavorInitializers
        def self.mysql2
          AppOpticsAPM.logger.info '[appoptics_apm/loading] Instrumenting activerecord mysql2adapter' if AppOpticsAPM::Config[:verbose]

          AppOpticsAPM::Util.send_include(::ActiveRecord::ConnectionAdapters::Mysql2Adapter,
                                  ::AppOpticsAPM::Inst::ConnectionAdapters::Utils)

          if (::ActiveRecord::VERSION::MAJOR == 3 && ::ActiveRecord::VERSION::MINOR == 0) ||
              ::ActiveRecord::VERSION::MAJOR == 2
            # ActiveRecord 3.0 and prior
            AppOpticsAPM::Util.method_alias(::ActiveRecord::ConnectionAdapters::Mysql2Adapter, :execute)
          else
            # ActiveRecord 3.1 and above
            AppOpticsAPM::Util.method_alias(::ActiveRecord::ConnectionAdapters::Mysql2Adapter, :exec_insert)
            AppOpticsAPM::Util.method_alias(::ActiveRecord::ConnectionAdapters::Mysql2Adapter, :exec_query)
            AppOpticsAPM::Util.method_alias(::ActiveRecord::ConnectionAdapters::Mysql2Adapter, :exec_delete)
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
appoptics_apm-4.0.6 lib/appoptics_apm/frameworks/rails/inst/connection_adapters/mysql2.rb
appoptics_apm-4.0.5 lib/appoptics_apm/frameworks/rails/inst/connection_adapters/mysql2.rb
appoptics_apm-4.0.4 lib/appoptics_apm/frameworks/rails/inst/connection_adapters/mysql2.rb
appoptics_apm-4.0.3 lib/appoptics_apm/frameworks/rails/inst/connection_adapters/mysql2.rb
appoptics_apm-4.0.2 lib/appoptics_apm/frameworks/rails/inst/connection_adapters/mysql2.rb
appoptics_apm-4.0.1-x86_64-linux lib/appoptics_apm/frameworks/rails/inst/connection_adapters/mysql2.rb