Module: Oboe::Inst::ConnectionAdapters::LegacyMysqlAdapter

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

Overview

MysqlAdapter

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



165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
# File 'lib/oboe/frameworks/rails/inst/active_record.rb', line 165

def self.included(cls)
  cls.class_eval do
    if ActiveRecord::ConnectionAdapters::MysqlAdapter::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
    
    if ::Rails::VERSION::MAJOR == 3 and ::Rails::VERSION::MINOR == 1
      if ActiveRecord::ConnectionAdapters::MysqlAdapter::method_defined? :begin_db_transaction
        alias begin_db_transaction_without_oboe begin_db_transaction
        alias begin_db_transaction begin_db_transaction_with_oboe
      else puts "[oboe/loading] Couldn't properly instrument ActiveRecord layer.  Partial traces may occur."
      end
    end
    
    if ::Rails::VERSION::MAJOR == 3 and ::Rails::VERSION::MINOR > 0
      if ActiveRecord::ConnectionAdapters::MysqlAdapter::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::MysqlAdapter::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