Sha256: 59c0f54dd917d93f191c94abf2c728d0e7537303e6ca7205150c4f2633525686
Contents?: true
Size: 971 Bytes
Versions: 3
Compression:
Stored size: 971 Bytes
Contents
# frozen_string_literal: true require_relative "active_support_subscriber" module PlainApm module Hooks class ActiveRecord < ActiveSupportSubscriber NOTIFICATION_PATTERN = /\A[^!]\w+\.active_record\Z/.freeze IGNORED_SQL_NAMES = %w[SCHEMA CACHE].freeze private def notification_pattern NOTIFICATION_PATTERN end def payload(event) name, base = attributes_from_notification(event) payload = event.payload return if IGNORED_SQL_NAMES.include?(payload[:name]) case name when "sql" base.tap do |o| o[:sql] = payload[:sql] o[:sql_name] = payload[:name] o[:async] = payload[:async] end when "instantiation" base.tap do |o| o[:class_name] = payload[:class_name] o[:record_count] = payload[:record_count] end else nil end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
plain_apm-0.10.2 | lib/plain_apm/hooks/active_record.rb |
plain_apm-0.10.0 | lib/plain_apm/hooks/active_record.rb |
plain_apm-0.9.8 | lib/plain_apm/hooks/active_record.rb |