Class: AlacrityRails::Probe::ActiveRecord

Inherits:
Object
  • Object
show all
Defined in:
lib/alacrity-rails/probe/active_record.rb

Class Method Summary collapse

Class Method Details

.activateObject



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/alacrity-rails/probe/active_record.rb', line 4

def self.activate
  ActiveSupport::Notifications.subscribe 'sql.active_record' do |name, started, finished, unique_id, data|
    AlacrityRails::Client.store_timeline_event(
      name: data[:name],
      event_type: 'database',
      engine: 'ActiveRecord',
      started_at: started,
      finished_at: finished,
      detail: data[:sql]
    )
  end
end