class HeimdallApm::ActionController::Subscriber

Public Instance Methods

finish(name, id, payload) click to toggle source
# File lib/heimdall_apm/instruments/action_controller.rb, line 19
def finish(name, id, payload)
  txn = ::HeimdallApm::TransactionManager.current
  txn.stop_segment
end
start(name, id, payload) click to toggle source
# File lib/heimdall_apm/instruments/action_controller.rb, line 4
def start(name, id, payload)
  txn     = ::HeimdallApm::TransactionManager.current
  scope   = -"#{payload[:controller]}##{payload[:action]}"
  segment = ::HeimdallApm::Segment.new('Controller'.freeze, scope)

  # Don't override scope if already set. Should never happen in practice
  # unless a controller calls another action.
  txn.scope = scope unless txn.scope

  # Rails gives us Request#fullpath
  txn.annotate({ uri: extract_path(payload[:path]) })

  txn.start_segment(segment)
end

Private Instance Methods

extract_path(fullpath) click to toggle source
# File lib/heimdall_apm/instruments/action_controller.rb, line 26
def extract_path(fullpath)
  i = fullpath.index('?'.freeze)
  i ? fullpath.slice(0, i) : fullpath
end