module NewRelic::Agent::Instrumentation::Roda::TransactionNamer

Constants

REGEX_MULTIPLE_SLASHES

Public Instance Methods

transaction_name(request) click to toggle source
# File lib/new_relic/agent/instrumentation/roda/roda_transaction_namer.rb, line 14
def transaction_name(request)
  path = request.path || ::NewRelic::Agent::UNKNOWN_METRIC
  name = path.gsub(REGEX_MULTIPLE_SLASHES, '\1') # remove any rogue slashes
  name = NewRelic::ROOT if name.empty?
  name = "#{request.request_method} #{name}" if request.respond_to?(:request_method)

  name
rescue => e
  ::NewRelic::Agent.logger.debug("#{e.class} : #{e.message} - Error encountered trying to identify Roda transaction name")
  ::NewRelic::Agent::UNKNOWN_METRIC
end