Sha256: 907f2ac8639e1fbed7ec4d2cc03ae3a20f953b06381130f6a80e3d010637cf74

Contents?: true

Size: 1.72 KB

Versions: 18

Compression:

Stored size: 1.72 KB

Contents

require 'new_relic/metric_parser'
module NewRelic
  module MetricParser
    class Controller < NewRelic::MetricParser::MetricParser

      def is_controller?; true; end
      def is_transaction?; true; end

      # If the controller name segments look like a file path, convert it to the controller
      # class name.  If it begins with a capital letter, assume it's already a class name.
      # We only expect a lower case letter with Rails, so we'll be able to use camelize for 
      # that.
      def controller_name
        path = segments[1..-2].join('/')
        path < 'a' ? path : path.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
      
      def is_web_transaction?
        true
      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
      
      def summary_metrics
        %w[HttpDispatcher]
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
newrelic_rpm-2.14.1.logging1 vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller.rb
newrelic_rpm-2.14.1 vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller.rb
newrelic_rpm-2.13.4.rum6 vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller.rb
newrelic_rpm-2.14.0 vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller.rb
newrelic_rpm-2.13.4.rum5 vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller.rb
newrelic_rpm-2.13.6.beta2 vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller.rb
newrelic_rpm-2.13.6.beta1 vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller.rb
newrelic_rpm-2.13.4.rum4 vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller.rb
newrelic_rpm-2.13.5.beta4 vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller.rb
newrelic_rpm-2.13.5.beta3 vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller.rb
newrelic_rpm-2.13.5.beta2 vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller.rb
newrelic_rpm-2.13.5.beta1 vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller.rb
newrelic_rpm-2.13.4.eum3 vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller.rb
newrelic_rpm-2.13.4.eum2 vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller.rb
newrelic_rpm-2.13.4.eum1 vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller.rb
newrelic_rpm-2.13.4 vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller.rb
newrelic_rpm-2.13.3 vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller.rb
newrelic_rpm-2.13.3.beta vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller.rb