class NewRelic::Agent::Instrumentation::ActionDispatchSubscriber

Constants

METHOD_NAME_MAPPING
PATTERN
UNKNOWN

Public Instance Methods

finish(name, id, payload) click to toggle source
# File lib/new_relic/agent/instrumentation/action_dispatch_subscriber.rb, line 19
def finish(name, id, payload)
  return unless state.is_execution_traced?

  finish_segment(id, payload)
rescue => e
  log_notification_error(e, name, 'finish')
end
finish_segment(id, payload) click to toggle source
# File lib/new_relic/agent/instrumentation/action_dispatch_subscriber.rb, line 32
def finish_segment(id, payload)
  if segment = pop_segment(id)
    if exception = exception_object(payload)
      segment.notice_error(exception)
    end
    segment.finish
  end
end
method_from_name(name) click to toggle source
# File lib/new_relic/agent/instrumentation/action_dispatch_subscriber.rb, line 58
def method_from_name(name)
  METHOD_NAME_MAPPING[name]
end
metric_name(name, payload) click to toggle source
# File lib/new_relic/agent/instrumentation/action_dispatch_subscriber.rb, line 41
def metric_name(name, payload)
  middleware = payload[:middleware]
  method = method_from_name(name)
  "Ruby/ActionDispatch/#{middleware}/#{method}"
end
start(name, id, payload) click to toggle source
# File lib/new_relic/agent/instrumentation/action_dispatch_subscriber.rb, line 11
def start(name, id, payload)
  return unless state.is_execution_traced?

  start_segment(name, id, payload)
rescue => e
  log_notification_error(e, name, 'start')
end
start_segment(name, id, payload) click to toggle source
# File lib/new_relic/agent/instrumentation/action_dispatch_subscriber.rb, line 27
def start_segment(name, id, payload)
  segment = Tracer.start_segment(name: metric_name(name, payload))
  push_segment(id, segment)
end