Sha256: 6d634ca2da48a08d277236c1e5e7d2d68df5500090059d0fb5475126975714b2

Contents?: true

Size: 1.84 KB

Versions: 66

Compression:

Stored size: 1.84 KB

Contents

# encoding: utf-8
# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.

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

66 entries across 66 versions & 2 rubygems

Version Path
newrelic_rpm-3.16.2.321 vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller.rb
newrelic_rpm-3.16.1.320 vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller.rb
newrelic_rpm-3.16.0.318 vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-3.15.2.317/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller.rb
newrelic_rpm-3.15.2.317 vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller.rb
newrelic_rpm-3.15.1.316 vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller.rb
newrelic_rpm-3.15.0.314 vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller.rb
newrelic_rpm-3.14.3.313 vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller.rb
newrelic_rpm-3.14.2.312 vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller.rb
newrelic_rpm-3.14.1.311 vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller.rb
newrelic_rpm-3.14.0.305 vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller.rb
newrelic_rpm-3.13.2.302 vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller.rb
newrelic_rpm-3.13.1.300 vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller.rb
newrelic_rpm-3.13.0.299 vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller.rb
newrelic_rpm-3.12.1.298 vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller.rb
newrelic_rpm-3.12.0.288 vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller.rb
newrelic_rpm-3.11.2.286 vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller.rb
newrelic_rpm-3.11.1.284 vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller.rb
newrelic_rpm-3.11.0.283 vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller.rb
newrelic_rpm-3.10.0.279 vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller.rb