class OneApm::Agent::Instrumentation::ActionControllerSubscriber

Public Instance Methods

filter(params) click to toggle source
# File lib/one_apm/inst/rails4/action_controller_subscriber.rb, line 58
def filter(params)
  munged_params = params.dup
  munged_params.delete('controller')
  munged_params.delete('action')
  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/one_apm/inst/rails4/action_controller_subscriber.rb, line 28
def finish(name, id, payload)
  event = pop_event(id)
  event.payload.merge!(payload)

  state = TransactionState.tl_get

  if state.is_execution_traced? && !event.ignored?
    stop_transaction(state, event)
  else
    OneApm::Manager.agent.pop_trace_execution_flag
  end
rescue => e
  log_notification_error(e, name, 'finish')
end
start(name, id, payload) click to toggle source
# File lib/one_apm/inst/rails4/action_controller_subscriber.rb, line 10
def start(name, id, payload)
  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
    OneApm::Manager.agent.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/one_apm/inst/rails4/action_controller_subscriber.rb, line 43
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/one_apm/inst/rails4/action_controller_subscriber.rb, line 51
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