Class: SystemMetrics::Instrument::ActiveRecord

Inherits:
Base
  • Object
show all
Defined in:
lib/system_metrics/instrument/active_record.rb

Instance Attribute Summary

Attributes inherited from Base

#pattern

Instance Method Summary collapse

Methods inherited from Base

#handles?, #mapped_paths, #prune_path

Constructor Details

#initializeActiveRecord

Returns a new instance of ActiveRecord.



5
6
7
# File 'lib/system_metrics/instrument/active_record.rb', line 5

def initialize
  super /\.active_record$/
end

Instance Method Details

#ignore?(event) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/system_metrics/instrument/active_record.rb', line 9

def ignore?(event)
  event.payload[:sql] !~ /^(SELECT|INSERT|UPDATE|DELETE)/
end

#prepare(event) ⇒ Object



13
14
15
16
# File 'lib/system_metrics/instrument/active_record.rb', line 13

def prepare(event)
  event.payload[:sql] = event.payload[:sql].squeeze(" ")
  event.payload.delete(:connection_id)
end