Sha256: 94ef5e9d75e8d2785b402b14ed86d7243a64e6d58d17e96b5fa70bc1ea9feee3

Contents?: true

Size: 1.01 KB

Versions: 2

Compression:

Stored size: 1.01 KB

Contents

class NewRelic::MetricParser::Controller < NewRelic::MetricParser
  
  def is_controller?
    true
  end
  
  def controller_name
    segments[1..-2].join('/').camelize+"Controller"
  end

  def action_name
    if segments[-1] =~ /^\(other\)$/
      '(template only)'
    else
      segments[-1]
    end
  end
  
  def developer_name
    "#{controller_name}##{action_name}"
  end
  
  # return the cpu measuring equivalent.  It may be nil since this metric was not
  # present in earlier versions of the agent.
  def cpu_metric
    Metric.lookup((["ControllerCPU"] + segments[1..-1]).join('/'), "", :create => false)
  end
  
  def short_name
    # standard controller actions
    if segments.length > 1
      url
    else
      'All Controller Actions'
    end
  end
  
  def url
    '/' + segments[1..-1].join('/')
  end
  
  # this is used to match transaction traces to controller actions.  
  # TT's don't have a preceding slash :P
  def tt_path
    segments[1..-1].join('/')
  end

  def call_rate_suffix
    'rpm'
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
newrelic_rpm-2.9.2 lib/new_relic/metric_parser/controller.rb
newrelic_rpm-2.9.3 lib/new_relic/metric_parser/controller.rb