Class: Metrician::ActiveRecord

Inherits:
Reporter
  • Object
show all
Defined in:
lib/metrician/reporters/active_record.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Reporter

all, inherited

Class Method Details

.enabled?Boolean

Returns:

  • (Boolean)


5
6
7
8
# File 'lib/metrician/reporters/active_record.rb', line 5

def self.enabled?
  !!defined?(::ActiveRecord) &&
    Metrician.configuration[:database][:enabled]
end

Instance Method Details

#instrumentObject



10
11
12
13
14
# File 'lib/metrician/reporters/active_record.rb', line 10

def instrument
  ::ActiveRecord::ConnectionAdapters::AbstractAdapter.module_eval do
    include QueryInterceptor
  end
end