Class: NewRelic::MetricParser::Controller
Constant Summary
SEPARATOR
Instance Attribute Summary
#name
Instance Method Summary
collapse
#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, #segment_5, #segments, #tooltip_name
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class NewRelic::MetricParser
Instance Method Details
#action_name ⇒ Object
15
16
17
18
19
20
21
|
# File 'lib/new_relic/metric_parser/controller.rb', line 15
def action_name
if segments[-1] =~ /^\(other\)$/
'(template only)'
else
segments[-1]
end
end
|
#call_rate_suffix ⇒ Object
55
56
57
|
# File 'lib/new_relic/metric_parser/controller.rb', line 55
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. We only expect a lower case letter with Rails, so we’ll be able to use camelize for that.
10
11
12
13
|
# File 'lib/new_relic/metric_parser/controller.rb', line 10
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.
32
33
34
|
# File 'lib/new_relic/metric_parser/controller.rb', line 32
def cpu_metric
Metric.lookup((["ControllerCPU"] + segments[1..-1]).join('/'), :create => false)
end
|
#developer_name ⇒ Object
23
24
25
|
# File 'lib/new_relic/metric_parser/controller.rb', line 23
def developer_name
"#{controller_name}##{action_name}"
end
|
#is_controller? ⇒ Boolean
3
|
# File 'lib/new_relic/metric_parser/controller.rb', line 3
def is_controller?; true; end
|
#is_transaction? ⇒ Boolean
4
|
# File 'lib/new_relic/metric_parser/controller.rb', line 4
def is_transaction?; true; end
|
#is_web_transaction? ⇒ Boolean
27
28
29
|
# File 'lib/new_relic/metric_parser/controller.rb', line 27
def is_web_transaction?
true
end
|
#short_name ⇒ Object
36
37
38
39
40
41
42
43
|
# File 'lib/new_relic/metric_parser/controller.rb', line 36
def short_name
if segments.length > 1
url
else
'All Controller Actions'
end
end
|
#summary_metrics ⇒ Object
59
60
61
|
# File 'lib/new_relic/metric_parser/controller.rb', line 59
def summary_metrics
%w[HttpDispatcher]
end
|
#tt_path ⇒ Object
this is used to match transaction traces to controller actions. TT’s don’t have a preceding slash :P
51
52
53
|
# File 'lib/new_relic/metric_parser/controller.rb', line 51
def tt_path
segments[1..-1].join('/')
end
|
#url ⇒ Object
45
46
47
|
# File 'lib/new_relic/metric_parser/controller.rb', line 45
def url
'/' + segments[1..-1].join('/')
end
|