Module: Rails::Instrumentation::ActiveRecordSubscriber
- Includes:
- Subscriber
- Defined in:
- lib/rails/instrumentation/subscribers/active_record_subscriber.rb
Constant Summary collapse
- EVENT_NAMESPACE =
'active_record'.freeze
- EVENTS =
%w[ sql instantiation ].freeze
- BASE_TAGS =
rubocop:disable Style/MutableConstant
{ 'component' => 'ActiveRecord' }
Class Method Summary collapse
Methods included from Subscriber
Class Method Details
.instantiation(event) ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/rails/instrumentation/subscribers/active_record_subscriber.rb', line 34 def instantiation(event) = ( 'record.count' => event.payload[:record_count], 'record.class' => event.payload[:class_name] ) Utils.trace_notification(event: event, tags: ) end |
.sql(event) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/rails/instrumentation/subscribers/active_record_subscriber.rb', line 20 def sql(event) raw = event.payload[:sql] statement = raw.respond_to?(:to_str) ? raw : raw.to_s = ( '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: ) end |