class NewRelic::Agent::Instrumentation::ActionControllerSubscriber

Public Instance Methods

filter(params) click to toggle source
# File lib/new_relic/agent/instrumentation/action_controller_subscriber.rb, line 60
def filter(params)
  munged_params = NewRelic::Agent::ParameterFiltering.filter_rails_request_parameters(params)
  filters = Rails.application.config.filter_parameters
  ActionDispatch::Http::ParameterFilter.new(filters).filter(munged_params)
end
finish(name, id, payload) click to toggle source
# File lib/new_relic/agent/instrumentation/action_controller_subscriber.rb, line 30
def finish(name, id, payload) #THREAD_LOCAL_ACCESS
  event = pop_event(id)
  event.payload.merge!(payload)

  state = TransactionState.tl_get

  if state.is_execution_traced? && !event.ignored?
    stop_transaction(state, event)
  else
    Agent.instance.pop_trace_execution_flag
  end
rescue => e
  log_notification_error(e, name, 'finish')
end
start(name, id, payload) click to toggle source
# File lib/new_relic/agent/instrumentation/action_controller_subscriber.rb, line 12
def start(name, id, payload) #THREAD_LOCAL_ACCESS
  state = TransactionState.tl_get
  request = state.request
  event = ControllerEvent.new(name, Time.now, nil, id, payload, request)
  push_event(event)

  if state.is_execution_traced? && !event.ignored?
    start_transaction(state, event)
  else
    # if this transaction is ignored, make sure child
    # transaction are also ignored
    state.current_transaction.ignore! if state.current_transaction
    NewRelic::Agent.instance.push_trace_execution_flag(false)
  end
rescue => e
  log_notification_error(e, name, 'start')
end
start_transaction(state, event) click to toggle source
# File lib/new_relic/agent/instrumentation/action_controller_subscriber.rb, line 45
def start_transaction(state, event)
  Transaction.start(state, :controller,
                    :request          => event.request,
                    :filtered_params  => filter(event.payload[:params]),
                    :apdex_start_time => event.queue_start,
                    :transaction_name => event.metric_name)
end
stop_transaction(state, event) click to toggle source
# File lib/new_relic/agent/instrumentation/action_controller_subscriber.rb, line 53
def stop_transaction(state, event)
  txn = state.current_transaction
  txn.ignore_apdex!   if event.apdex_ignored?
  txn.ignore_enduser! if event.enduser_ignored?
  Transaction.stop(state)
end