Module: Oboe::Inst::ConnectionAdapters::Mysql2Adapter

Includes:
Utils
Defined in:
lib/oboe/frameworks/rails/inst/active_record.rb

Overview

LegacyMysqlAdapter

Class Method Summary collapse

Methods included from Utils

#begin_db_transaction_with_oboe, #cfg, #exec_delete_with_oboe, #exec_insert_with_oboe, #exec_query_with_oboe, #execute_with_oboe, #extract_trace_details, #ignore_payload?

Class Method Details

.included(cls) ⇒ Object



201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
# File 'lib/oboe/frameworks/rails/inst/active_record.rb', line 201

def self.included(cls)
  cls.class_eval do
    if ::Rails::VERSION::MAJOR == 2 or (::Rails::VERSION::MAJOR == 3 and ::Rails::VERSION::MINOR == 0)
      if ActiveRecord::ConnectionAdapters::Mysql2Adapter::method_defined? :execute
        alias execute_without_oboe execute
        alias execute execute_with_oboe
      else puts "[oboe/loading] Couldn't properly instrument ActiveRecord layer.  Partial traces may occur."
      end
    else
      if ActiveRecord::ConnectionAdapters::Mysql2Adapter::method_defined? :exec_insert
        alias exec_insert_without_oboe exec_insert
        alias exec_insert exec_insert_with_oboe
      else puts "[oboe/loading] Couldn't properly instrument ActiveRecord layer.  Partial traces may occur."
      end
     
      # In Rails 3.1, exec_query was defined as a private method
      if ActiveRecord::ConnectionAdapters::Mysql2Adapter::method_defined? :exec_query or
        ActiveRecord::ConnectionAdapters::Mysql2Adapter::private_method_defined? :exec_query
        alias exec_query_without_oboe exec_query
        alias exec_query exec_query_with_oboe
      else puts "[oboe/loading] Couldn't properly instrument ActiveRecord layer.  Partial traces may occur."
      end
      
      if ActiveRecord::ConnectionAdapters::Mysql2Adapter::method_defined? :exec_delete
        alias exec_delete_without_oboe exec_delete
        alias exec_delete exec_delete_with_oboe
      else puts "[oboe/loading] Couldn't properly instrument ActiveRecord layer.  Partial traces may occur."
      end
    end
  end
end