Class: NewRelic::MetricParser::View

Inherits:
NewRelic::MetricParser show all
Defined in:
lib/new_relic/metric_parser/view.rb

Constant Summary

Constants inherited from NewRelic::MetricParser

SEPARATOR

Instance Attribute Summary

Attributes inherited from NewRelic::MetricParser

#name

Instance Method Summary collapse

Methods inherited from NewRelic::MetricParser

#apdex_metric_path, #base_metric_name, #call_rate_suffix, #category, for_metric_named, #initialize, #last_segment, #legend_name, #method_missing, parse, #segment_0, #segment_1, #segment_2, #segment_3, #segment_4, #segments, #tooltip_name

Constructor Details

This class inherits a constructor from NewRelic::MetricParser

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class NewRelic::MetricParser

Instance Method Details

#action_nameObject



43
44
45
46
# File 'lib/new_relic/metric_parser/view.rb', line 43

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

#controller_nameObject



39
40
41
# File 'lib/new_relic/metric_parser/view.rb', line 39

def controller_name
  template_label
end

#developer_nameObject



48
49
50
# File 'lib/new_relic/metric_parser/view.rb', line 48

def developer_name
  template_label
end

#is_compiler?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/new_relic/metric_parser/view.rb', line 7

def is_compiler?
  segments.last == "Compile"
end

#is_render?Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/new_relic/metric_parser/view.rb', line 4

def is_render?
  segments.last == "Rendering"
end

#is_view?Boolean

Returns:

  • (Boolean)


2
# File 'lib/new_relic/metric_parser/view.rb', line 2

def is_view?; true; end

#pie_chart_labelObject



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/new_relic/metric_parser/view.rb', line 10

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

#short_nameObject



35
36
37
# File 'lib/new_relic/metric_parser/view.rb', line 35

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

#template_labelObject



22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/new_relic/metric_parser/view.rb', line 22

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

#urlObject



52
53
54
# File 'lib/new_relic/metric_parser/view.rb', line 52

def url
  '/' + file_name(segments[1..-2].join('/'))
end