Sha256: 6b83afb5a49be8ae5beb577c076610b878c4bc8772f5b590e9bfc0eb9c2d0127
Contents?: true
Size: 646 Bytes
Versions: 12
Compression:
Stored size: 646 Bytes
Contents
module Librato module Rails module Subscribers # SQL ActiveSupport::Notifications.subscribe 'sql.active_record' do |*args| payload = args.last collector.group "rails.sql" do |s| # puts (payload[:name] || 'nil') + ":" + payload[:sql] + "\n\n" s.increment 'queries' sql = payload[:sql].strip s.increment 'selects' if sql.starts_with?('SELECT') s.increment 'inserts' if sql.starts_with?('INSERT') s.increment 'updates' if sql.starts_with?('UPDATE') s.increment 'deletes' if sql.starts_with?('DELETE') end end end end end
Version data entries
12 entries across 12 versions & 1 rubygems