Sha256: 05cca2f5c910982ffd0f8b538f2ee2cf49180f2d358adbb853fe93dd3a2872f2

Contents?: true

Size: 1.6 KB

Versions: 20

Compression:

Stored size: 1.6 KB

Contents

require 'new_relic/metric_parser'
module NewRelic
  module MetricParser
    class View < NewRelic::MetricParser::MetricParser
      def is_view?; true; end

      def is_render?
        segments.last == "Rendering"
      end
      def is_compiler?
        segments.last == "Compile"
      end
      def pie_chart_label
        case segments.last
        when "Rendering"
          "#{file_name(segments[-2])} Template"
        when "Partial"
          "#{file_name(segments[-2])} Partial"
        when ".rhtml Processing"
          "ERB compilation"
        else
          segments[1..-1]
        end
      end
      def template_label
        case segments.last
        when "Rendering"
          "#{file_name(segments[1..-2].join(NewRelic::MetricParser::MetricParser::SEPARATOR))} Template"
        when "Partial"
          "#{file_name(segments[1..-2].join(NewRelic::MetricParser::MetricParser::SEPARATOR))} Partial"
        when ".rhtml Processing"
          "ERB compilation"
        else
          segments[1..-1].join("/")
        end
      end

      def short_name
        segments[1..-2].join(NewRelic::MetricParser::MetricParser::SEPARATOR)
      end

      def controller_name
        template_label
      end

      def action_name
        # Strip the extension
        segments[-2].gsub(/\..*$/, "")
      end

      def developer_name
        template_label
      end

      def url
        '/' + file_name(segments[1..-2].join('/'))
      end
      private
      def file_name(path)
        label = path.gsub /\.html\.rhtml/, '.rhtml'
        label = segments[1] if label.empty?
        label
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 2 rubygems

Version Path
newrelic_rpm-3.1.2 vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/view.rb
newrelic_rpm-3.1.2.beta2 vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/view.rb
newrelic_rpm-3.1.2.beta1 vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/view.rb
newrelic_rpm-3.1.1 vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/view.rb
newrelic_rpm-3.1.1.beta3 vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/view.rb
newrelic_rpm-3.1.1.beta2 vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/view.rb
newrelic_rpm-3.1.1.beta1 vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/view.rb
ghazel-newrelic_rpm-3.1.0.1 vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/view.rb
newrelic_rpm-3.1.0 vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/view.rb
newrelic_rpm-3.1.0.beta5 vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/view.rb
newrelic_rpm-3.1.0.beta4 vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/view.rb
newrelic_rpm-3.1.0.djlogging2 vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/view.rb
newrelic_rpm-3.1.0.djlogging vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/view.rb
newrelic_rpm-3.1.0.beta3 vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/view.rb
newrelic_rpm-3.1.0.beta2 vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/view.rb
newrelic_rpm-3.0.1 vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/view.rb
newrelic_rpm-3.1.0.beta1 vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/view.rb
newrelic_rpm-3.0.0 vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/view.rb
newrelic_rpm-3.0.0.beta2 vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/view.rb
newrelic_rpm-3.0.0.beta1 vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/view.rb