Sha256: b1e43e7c199a3452244e723d74421a787f3daa514f4af64bb3d89ac154a2a85e
Contents?: true
Size: 822 Bytes
Versions: 3
Compression:
Stored size: 822 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.merge({"sql" => payload[:sql], "sql_name" => payload[:name]}) when "instantiation" base.merge({"class_name" => payload[:class_name], "record_count" => payload[:record_count]}) end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
plain_apm-0.9.2 | lib/plain_apm/hooks/active_record.rb |
plain_apm-0.9.1 | lib/plain_apm/hooks/active_record.rb |
plain_apm-0.9.0 | lib/plain_apm/hooks/active_record.rb |