vendor/plugins/newrelic_rpm/lib/newrelic/agent/instrumentation/action_controller.rb
# Have NewRelic ignore actions in this controller.  Specify the actions as hash options
# using :except and :only.  If no actions are specified, all actions are ignored.
Have NewRelic ignore actions in this controller.  Specify the actions as hash options
using :except and :only.  If no actions are specified, all actions are ignored.
Have NewRelic ignore actions in this controller . Specify the actions as hash options using : except and : only . If no actions are specified all actions are ignored .
def perform_action_with_newrelic_trace
      agent = NewRelic::Agent.instance
      ignore_actions = self.class.read_inheritable_attribute('do_not_trace')
      if ignore_actions
        should_skip = false
        if Hash === ignore_actions
          only_actions = Array(ignore_actions[:only])
          except_actions = Array(ignore_actions[:except])
          should_skip = true if only_actions.include? action_name.to_sym
          should_skip = true if except_actions.any? && !except_actions.include?(action_name.to_sym)
        else
          should_skip = true
        end
        if should_skip
          Thread.current[:controller_ignored] = true
          return perform_action_without_newrelic_trace
        end
      end
      agent.ensure_started
      self.class.trace_method_execution "Controller", false, true, true do 
        path = _determine_metric_path
        agent.stats_engine.transaction_name ||= "Controller/#{path}" if agent.stats_engine
        self.class.trace_method_execution "Controller/#{path}", true, true, true do 
          local_params = (respond_to? :filter_parameters) ? filter_parameters(params) : params
          agent.transaction_sampler.notice_transaction(path, request, local_params)
          t = Process.times.utime + Process.times.stime
          begin
            perform_action_without_newrelic_trace
          ensure
            agent.transaction_sampler.notice_transaction_cpu_time((Process.times.utime + Process.times.stime) - t)
          end
        end
      end
    ensure
      agent.stats_engine.transaction_name = nil
    end
def perform_action_with_newrelic_trace agent = NewRelic :: Agent . instance ignore_actions = self . class . read_inheritable_attribute ( 'do_not_trace' ) if ignore_actions should_skip = false if Hash === ignore_actions only_actions = Array ( ignore_actions [ :only ] ) except_actions = Array ( ignore_actions [ :except ] ) should_skip = true if only_actions . include? action_name . to_sym should_skip = true if except_actions . any? && ! except_actions . include? ( action_name . to_sym ) else should_skip = true end if should_skip Thread . current [ :controller_ignored ] = true return perform_action_without_newrelic_trace end end agent . ensure_started self . class . trace_method_execution "Controller" , false , true , true do path = _determine_metric_path agent . stats_engine . transaction_name ||= "Controller/#{path}" if agent . stats_engine self . class . trace_method_execution "Controller/#{path}" , true , true , true do local_params = ( respond_to? :filter_parameters ) ? filter_parameters ( params ) : params agent . transaction_sampler . notice_transaction ( path , request , local_params ) t = Process . times . utime + Process . times . stime begin perform_action_without_newrelic_trace ensure agent . transaction_sampler . notice_transaction_cpu_time ( ( Process . times . utime + Process . times . stime ) - t ) end end end ensure agent . stats_engine . transaction_name = nil end
Have NewRelic ignore actions in this controller.
Have NewRelic ignore actions in this controller .
# Skip instrumentation based on the value of 'do_not_trace' # generate metrics for all all controllers (no scope) # generate metrics for this specific action # send request and parameter info to the transaction sampler # run the action # clear out the name of the traced transaction under all circumstances