Sha256: bc49ab0fce55d1bd2055a396ac483b09339816515338fabcc3beca2aa7a0bd08
Contents?: true
Size: 854 Bytes
Versions: 5
Compression:
Stored size: 854 Bytes
Contents
require "nunes/subscriber" module Nunes module Subscribers class ActiveRecord < ::Nunes::Subscriber # Private Pattern = /\.active_record\Z/ # Private: The namespace for events to subscribe to. def self.pattern Pattern end def sql(start, ending, transaction_id, payload) runtime = ((ending - start) * 1_000).round name = payload[:name] sql = payload[:sql].to_s.strip operation = sql.split(' ', 2).first.to_s.downcase timing "active_record.sql", runtime case operation when "begin" timing "active_record.sql.transaction_begin", runtime when "commit" timing "active_record.sql.transaction_commit", runtime else timing "active_record.sql.#{operation}", runtime end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems