Sha256: 0732ad5075bcd7b6be998759ad6bfa7086176a8cabbceec7a4d1f04c9b4c6b61

Contents?: true

Size: 1.79 KB

Versions: 13

Compression:

Stored size: 1.79 KB

Contents

module NewRelic
  module Agent
    module Instrumentation
      module Rails3
        module ActionController
          def self.newrelic_write_attr(attr_name, value) # :nodoc:
            write_inheritable_attribute(attr_name, value)
          end

          def self.newrelic_read_attr(attr_name) # :nodoc:
            read_inheritable_attribute(attr_name)
          end

          # determine the path that is used in the metric name for
          # the called controller action
          def newrelic_metric_path(action_name_override = nil)
            action_part = action_name_override || action_name
            if action_name_override || self.class.action_methods.include?(action_part)
              "#{self.class.controller_path}/#{action_part}"
            else
              "#{self.class.controller_path}/(other)"
            end
          end

          def process_action(*args)
            # skip instrumentation if we are in an ignored action
            if _is_filtered?('do_not_trace')
              NewRelic::Agent.disable_all_tracing do
                return super
              end
            end

            perform_action_with_newrelic_trace(:category => :controller, :name => self.action_name, :path => newrelic_metric_path, :params => request.filtered_parameters, :class_name => self.class.name)  do
              super
            end
          end

        end
      end
    end
  end
end

DependencyDetection.defer do
  depends_on do
    defined?(Rails) && Rails::VERSION::MAJOR.to_i == 3
  end

  depends_on do
    defined?(ActionController) && defined?(ActionController::Base)
  end

  executes do
    class ActionController::Base
      include NewRelic::Agent::Instrumentation::ControllerInstrumentation
      include NewRelic::Agent::Instrumentation::Rails3::ActionController
    end
  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
ghazel-newrelic_rpm-3.1.0.1 lib/new_relic/agent/instrumentation/rails3/action_controller.rb
newrelic_rpm-3.1.0 lib/new_relic/agent/instrumentation/rails3/action_controller.rb
newrelic_rpm-3.1.0.beta5 lib/new_relic/agent/instrumentation/rails3/action_controller.rb
newrelic_rpm-3.1.0.beta4 lib/new_relic/agent/instrumentation/rails3/action_controller.rb
newrelic_rpm-3.1.0.djlogging2 lib/new_relic/agent/instrumentation/rails3/action_controller.rb
newrelic_rpm-3.1.0.djlogging lib/new_relic/agent/instrumentation/rails3/action_controller.rb
newrelic_rpm-3.1.0.beta3 lib/new_relic/agent/instrumentation/rails3/action_controller.rb
newrelic_rpm-3.1.0.beta2 lib/new_relic/agent/instrumentation/rails3/action_controller.rb
newrelic_rpm-3.0.1 lib/new_relic/agent/instrumentation/rails3/action_controller.rb
newrelic_rpm-3.1.0.beta1 lib/new_relic/agent/instrumentation/rails3/action_controller.rb
newrelic_rpm-3.0.0 lib/new_relic/agent/instrumentation/rails3/action_controller.rb
newrelic_rpm-3.0.0.beta2 lib/new_relic/agent/instrumentation/rails3/action_controller.rb
newrelic_rpm-3.0.0.beta1 lib/new_relic/agent/instrumentation/rails3/action_controller.rb