Module: NewRelic::Agent::Instrumentation::Rails4::ActionController

Defined in:
lib/new_relic/agent/instrumentation/rails4/action_controller.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.newrelic_read_attr(attr_name) ⇒ Object

:nodoc:



14
15
16
# File 'lib/new_relic/agent/instrumentation/rails4/action_controller.rb', line 14

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

.newrelic_write_attr(attr_name, value) ⇒ Object

:nodoc:



10
11
12
# File 'lib/new_relic/agent/instrumentation/rails4/action_controller.rb', line 10

def self.newrelic_write_attr(attr_name, value) # :nodoc:
  write_inheritable_attribute(attr_name, value)
end

Instance Method Details

#newrelic_metric_path(action_name_override = nil) ⇒ Object

determine the path that is used in the metric name for the called controller action



20
21
22
23
24
25
26
27
# File 'lib/new_relic/agent/instrumentation/rails4/action_controller.rb', line 20

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

#process_action(*args) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/new_relic/agent/instrumentation/rails4/action_controller.rb', line 29

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