Sha256: cbcf3df5208731e04573bdff181d24b9984a14bb5a01b967dd918e9a50929336
Contents?: true
Size: 1.06 KB
Versions: 1
Compression:
Stored size: 1.06 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) tags = span_tags( 'db.statement' => event.payload[:sql], '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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rails-instrumentation-0.1.2 | lib/rails/instrumentation/subscribers/active_record_subscriber.rb |