Class: NewRelic::MetricParser::Controller
- Inherits:
-
NewRelic::MetricParser
- Object
- NewRelic::MetricParser
- NewRelic::MetricParser::Controller
- Defined in:
- lib/new_relic/metric_parser/controller.rb
Constant Summary
Constants inherited from NewRelic::MetricParser
Instance Attribute Summary
Attributes inherited from NewRelic::MetricParser
Instance Method Summary collapse
- #action_name ⇒ Object
- #call_rate_suffix ⇒ Object
-
#controller_name ⇒ Object
If the controller name segments look like a file path, convert it to the controller class name.
-
#cpu_metric ⇒ Object
return the cpu measuring equivalent.
- #developer_name ⇒ Object
- #is_controller? ⇒ Boolean
- #short_name ⇒ Object
-
#tt_path ⇒ Object
this is used to match transaction traces to controller actions.
- #url ⇒ Object
Methods inherited from NewRelic::MetricParser
#apdex_metric_path, #base_metric_name, #category, for_metric_named, #initialize, #last_segment, #legend_name, #method_missing, parse, #pie_chart_label, #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_name ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/new_relic/metric_parser/controller.rb', line 14 def action_name if segments[-1] =~ /^\(other\)$/ '(template only)' else segments[-1] end end |
#call_rate_suffix ⇒ Object
51 52 53 |
# File 'lib/new_relic/metric_parser/controller.rb', line 51 def call_rate_suffix 'rpm' end |
#controller_name ⇒ Object
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
9 10 11 12 |
# File 'lib/new_relic/metric_parser/controller.rb', line 9 def controller_name path = segments[1..-2].join('/') path < 'a' ? path : path.camelize+"Controller" end |
#cpu_metric ⇒ Object
return the cpu measuring equivalent. It may be nil since this metric was not present in earlier versions of the agent.
28 29 30 |
# File 'lib/new_relic/metric_parser/controller.rb', line 28 def cpu_metric Metric.lookup((["ControllerCPU"] + segments[1..-1]).join('/'), :create => false) end |
#developer_name ⇒ Object
22 23 24 |
# File 'lib/new_relic/metric_parser/controller.rb', line 22 def developer_name "#{controller_name}##{action_name}" end |
#is_controller? ⇒ Boolean
3 4 5 |
# File 'lib/new_relic/metric_parser/controller.rb', line 3 def is_controller? true end |
#short_name ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/new_relic/metric_parser/controller.rb', line 32 def short_name # standard controller actions if segments.length > 1 url else 'All Controller Actions' end end |
#tt_path ⇒ Object
this is used to match transaction traces to controller actions.
TT’s don’t have a preceding slash :P
47 48 49 |
# File 'lib/new_relic/metric_parser/controller.rb', line 47 def tt_path segments[1..-1].join('/') end |
#url ⇒ Object
41 42 43 |
# File 'lib/new_relic/metric_parser/controller.rb', line 41 def url '/' + segments[1..-1].join('/') end |