# encoding: utf-8 # This file is distributed under New Relic's license terms. # See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details. require 'new_relic/agent/instrumentation/active_record_subscriber' DependencyDetection.defer do @name = :active_record depends_on do defined?(::ActiveRecord) && defined?(::ActiveRecord::Base) && defined?(::ActiveRecord::VERSION) && ::ActiveRecord::VERSION::MAJOR.to_i >= 4 end depends_on do !NewRelic::Agent.config[:disable_activerecord_instrumentation] && !NewRelic::Agent::Instrumentation::ActiveRecordSubscriber.subscribed? end executes do ::NewRelic::Agent.logger.info 'Installing ActiveRecord 4 instrumentation' end executes do ActiveSupport::Notifications.subscribe('sql.active_record', NewRelic::Agent::Instrumentation::ActiveRecordSubscriber.new) end end