Sha256: 572f73312f80d1b6f477f511d4aac324e4c3ffab66ace37ab265467f34b01c05
Contents?: true
Size: 1.16 KB
Versions: 5
Compression:
Stored size: 1.16 KB
Contents
# require 'active_support' module Rails module Instrumentation module ActiveRecordSubscriber include Subscriber EVENT_NAMESPACE = 'active_record'.freeze EVENTS = %w[ sql instantiation ].freeze # rubocop:disable Style/MutableConstant BASE_TAGS = { 'component' => 'ActiveRecord' } # rubocop:enable Style/MutableConstant. class << self def sql(event) raw = event.payload[:sql] statement = raw.respond_to?(:to_str) ? raw : raw.to_s tags = span_tags( 'db.statement' => statement[0, 1024], 'name' => event.payload[:name], 'connection_id' => event.payload[:connection_id], 'binds' => event.payload[:binds], 'cached' => event.payload[:cached] ) Utils.trace_notification(event: event, tags: tags) end def instantiation(event) tags = span_tags( 'record.count' => event.payload[:record_count], 'record.class' => event.payload[:class_name] ) Utils.trace_notification(event: event, tags: tags) end end end end end
Version data entries
5 entries across 5 versions & 2 rubygems