honkster-newrelic_rpm 2.13.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +462 -0
- data/LICENSE +37 -0
- data/README.rdoc +172 -0
- data/bin/mongrel_rpm +33 -0
- data/bin/newrelic +13 -0
- data/bin/newrelic_cmd +5 -0
- data/cert/cacert.pem +34 -0
- data/install.rb +9 -0
- data/lib/new_relic/agent.rb +382 -0
- data/lib/new_relic/agent/agent.rb +741 -0
- data/lib/new_relic/agent/busy_calculator.rb +91 -0
- data/lib/new_relic/agent/chained_call.rb +13 -0
- data/lib/new_relic/agent/error_collector.rb +131 -0
- data/lib/new_relic/agent/instrumentation/active_merchant.rb +18 -0
- data/lib/new_relic/agent/instrumentation/active_record_instrumentation.rb +92 -0
- data/lib/new_relic/agent/instrumentation/acts_as_solr.rb +45 -0
- data/lib/new_relic/agent/instrumentation/authlogic.rb +8 -0
- data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +409 -0
- data/lib/new_relic/agent/instrumentation/data_mapper.rb +58 -0
- data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +22 -0
- data/lib/new_relic/agent/instrumentation/memcache.rb +40 -0
- data/lib/new_relic/agent/instrumentation/merb/controller.rb +26 -0
- data/lib/new_relic/agent/instrumentation/merb/errors.rb +9 -0
- data/lib/new_relic/agent/instrumentation/metric_frame.rb +319 -0
- data/lib/new_relic/agent/instrumentation/net.rb +17 -0
- data/lib/new_relic/agent/instrumentation/passenger_instrumentation.rb +22 -0
- data/lib/new_relic/agent/instrumentation/rack.rb +98 -0
- data/lib/new_relic/agent/instrumentation/rails/action_controller.rb +59 -0
- data/lib/new_relic/agent/instrumentation/rails/action_web_service.rb +27 -0
- data/lib/new_relic/agent/instrumentation/rails/errors.rb +24 -0
- data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +45 -0
- data/lib/new_relic/agent/instrumentation/rails3/errors.rb +21 -0
- data/lib/new_relic/agent/instrumentation/sinatra.rb +46 -0
- data/lib/new_relic/agent/instrumentation/sunspot.rb +17 -0
- data/lib/new_relic/agent/instrumentation/unicorn_instrumentation.rb +10 -0
- data/lib/new_relic/agent/method_tracer.rb +350 -0
- data/lib/new_relic/agent/sampler.rb +50 -0
- data/lib/new_relic/agent/samplers/cpu_sampler.rb +54 -0
- data/lib/new_relic/agent/samplers/delayed_job_lock_sampler.rb +37 -0
- data/lib/new_relic/agent/samplers/memory_sampler.rb +142 -0
- data/lib/new_relic/agent/samplers/object_sampler.rb +24 -0
- data/lib/new_relic/agent/shim_agent.rb +25 -0
- data/lib/new_relic/agent/stats_engine.rb +24 -0
- data/lib/new_relic/agent/stats_engine/metric_stats.rb +118 -0
- data/lib/new_relic/agent/stats_engine/samplers.rb +83 -0
- data/lib/new_relic/agent/stats_engine/transactions.rb +149 -0
- data/lib/new_relic/agent/transaction_sampler.rb +330 -0
- data/lib/new_relic/agent/worker_loop.rb +81 -0
- data/lib/new_relic/collection_helper.rb +71 -0
- data/lib/new_relic/command.rb +85 -0
- data/lib/new_relic/commands/deployments.rb +105 -0
- data/lib/new_relic/commands/install.rb +81 -0
- data/lib/new_relic/control.rb +203 -0
- data/lib/new_relic/control/configuration.rb +149 -0
- data/lib/new_relic/control/frameworks/external.rb +13 -0
- data/lib/new_relic/control/frameworks/merb.rb +24 -0
- data/lib/new_relic/control/frameworks/rails.rb +126 -0
- data/lib/new_relic/control/frameworks/rails3.rb +60 -0
- data/lib/new_relic/control/frameworks/ruby.rb +36 -0
- data/lib/new_relic/control/frameworks/sinatra.rb +18 -0
- data/lib/new_relic/control/instrumentation.rb +95 -0
- data/lib/new_relic/control/logging_methods.rb +74 -0
- data/lib/new_relic/control/profiling.rb +24 -0
- data/lib/new_relic/control/server_methods.rb +88 -0
- data/lib/new_relic/delayed_job_injection.rb +27 -0
- data/lib/new_relic/histogram.rb +91 -0
- data/lib/new_relic/local_environment.rb +333 -0
- data/lib/new_relic/merbtasks.rb +6 -0
- data/lib/new_relic/metric_data.rb +42 -0
- data/lib/new_relic/metric_parser.rb +136 -0
- data/lib/new_relic/metric_parser/action_mailer.rb +9 -0
- data/lib/new_relic/metric_parser/active_merchant.rb +26 -0
- data/lib/new_relic/metric_parser/active_record.rb +28 -0
- data/lib/new_relic/metric_parser/apdex.rb +88 -0
- data/lib/new_relic/metric_parser/controller.rb +62 -0
- data/lib/new_relic/metric_parser/controller_cpu.rb +38 -0
- data/lib/new_relic/metric_parser/errors.rb +6 -0
- data/lib/new_relic/metric_parser/external.rb +50 -0
- data/lib/new_relic/metric_parser/mem_cache.rb +50 -0
- data/lib/new_relic/metric_parser/other_transaction.rb +36 -0
- data/lib/new_relic/metric_parser/view.rb +61 -0
- data/lib/new_relic/metric_parser/web_frontend.rb +14 -0
- data/lib/new_relic/metric_parser/web_service.rb +9 -0
- data/lib/new_relic/metric_spec.rb +67 -0
- data/lib/new_relic/metrics.rb +9 -0
- data/lib/new_relic/noticed_error.rb +24 -0
- data/lib/new_relic/rack/developer_mode.rb +257 -0
- data/lib/new_relic/rack/metric_app.rb +64 -0
- data/lib/new_relic/rack/mongrel_rpm.ru +26 -0
- data/lib/new_relic/rack/newrelic.yml +27 -0
- data/lib/new_relic/rack_app.rb +6 -0
- data/lib/new_relic/recipes.rb +82 -0
- data/lib/new_relic/stats.rb +368 -0
- data/lib/new_relic/timer_lib.rb +27 -0
- data/lib/new_relic/transaction_analysis.rb +119 -0
- data/lib/new_relic/transaction_sample.rb +586 -0
- data/lib/new_relic/url_rule.rb +14 -0
- data/lib/new_relic/version.rb +55 -0
- data/lib/new_relic_api.rb +276 -0
- data/lib/newrelic_rpm.rb +49 -0
- data/lib/tasks/all.rb +4 -0
- data/lib/tasks/install.rake +7 -0
- data/lib/tasks/tests.rake +15 -0
- data/newrelic.yml +246 -0
- data/newrelic_rpm.gemspec +254 -0
- data/recipes/newrelic.rb +6 -0
- data/test/active_record_fixtures.rb +55 -0
- data/test/config/newrelic.yml +48 -0
- data/test/config/test_control.rb +36 -0
- data/test/new_relic/agent/active_record_instrumentation_test.rb +286 -0
- data/test/new_relic/agent/agent_controller_test.rb +294 -0
- data/test/new_relic/agent/agent_test_controller.rb +77 -0
- data/test/new_relic/agent/busy_calculator_test.rb +81 -0
- data/test/new_relic/agent/collection_helper_test.rb +125 -0
- data/test/new_relic/agent/error_collector_test.rb +163 -0
- data/test/new_relic/agent/memcache_instrumentation_test.rb +103 -0
- data/test/new_relic/agent/method_tracer_test.rb +340 -0
- data/test/new_relic/agent/metric_data_test.rb +53 -0
- data/test/new_relic/agent/metric_frame_test.rb +51 -0
- data/test/new_relic/agent/mock_scope_listener.rb +23 -0
- data/test/new_relic/agent/net_instrumentation_test.rb +77 -0
- data/test/new_relic/agent/rpm_agent_test.rb +142 -0
- data/test/new_relic/agent/stats_engine/metric_stats_test.rb +79 -0
- data/test/new_relic/agent/stats_engine/samplers_test.rb +72 -0
- data/test/new_relic/agent/stats_engine/stats_engine_test.rb +184 -0
- data/test/new_relic/agent/task_instrumentation_test.rb +188 -0
- data/test/new_relic/agent/testable_agent.rb +13 -0
- data/test/new_relic/agent/transaction_sample_builder_test.rb +195 -0
- data/test/new_relic/agent/transaction_sample_test.rb +192 -0
- data/test/new_relic/agent/transaction_sampler_test.rb +385 -0
- data/test/new_relic/agent/worker_loop_test.rb +66 -0
- data/test/new_relic/control_test.rb +127 -0
- data/test/new_relic/deployments_api_test.rb +69 -0
- data/test/new_relic/environment_test.rb +75 -0
- data/test/new_relic/metric_parser_test.rb +226 -0
- data/test/new_relic/metric_spec_test.rb +177 -0
- data/test/new_relic/rack/episodes_test.rb +318 -0
- data/test/new_relic/shim_agent_test.rb +9 -0
- data/test/new_relic/stats_test.rb +312 -0
- data/test/new_relic/version_number_test.rb +89 -0
- data/test/test_contexts.rb +28 -0
- data/test/test_helper.rb +72 -0
- data/ui/helpers/developer_mode_helper.rb +359 -0
- data/ui/helpers/google_pie_chart.rb +49 -0
- data/ui/views/layouts/newrelic_default.rhtml +47 -0
- data/ui/views/newrelic/_explain_plans.rhtml +27 -0
- data/ui/views/newrelic/_sample.rhtml +20 -0
- data/ui/views/newrelic/_segment.rhtml +29 -0
- data/ui/views/newrelic/_segment_limit_message.rhtml +1 -0
- data/ui/views/newrelic/_segment_row.rhtml +14 -0
- data/ui/views/newrelic/_show_sample_detail.rhtml +24 -0
- data/ui/views/newrelic/_show_sample_sql.rhtml +20 -0
- data/ui/views/newrelic/_show_sample_summary.rhtml +3 -0
- data/ui/views/newrelic/_sql_row.rhtml +16 -0
- data/ui/views/newrelic/_stack_trace.rhtml +15 -0
- data/ui/views/newrelic/_table.rhtml +12 -0
- data/ui/views/newrelic/explain_sql.rhtml +43 -0
- data/ui/views/newrelic/file/images/arrow-close.png +0 -0
- data/ui/views/newrelic/file/images/arrow-open.png +0 -0
- data/ui/views/newrelic/file/images/blue_bar.gif +0 -0
- data/ui/views/newrelic/file/images/file_icon.png +0 -0
- data/ui/views/newrelic/file/images/gray_bar.gif +0 -0
- data/ui/views/newrelic/file/images/new-relic-rpm-desktop.gif +0 -0
- data/ui/views/newrelic/file/images/new_relic_rpm_desktop.gif +0 -0
- data/ui/views/newrelic/file/images/textmate.png +0 -0
- data/ui/views/newrelic/file/javascript/jquery-1.4.2.js +6240 -0
- data/ui/views/newrelic/file/javascript/transaction_sample.js +120 -0
- data/ui/views/newrelic/file/stylesheets/style.css +484 -0
- data/ui/views/newrelic/index.rhtml +59 -0
- data/ui/views/newrelic/sample_not_found.rhtml +2 -0
- data/ui/views/newrelic/show_sample.rhtml +79 -0
- data/ui/views/newrelic/show_source.rhtml +3 -0
- data/ui/views/newrelic/threads.rhtml +52 -0
- metadata +307 -0
@@ -0,0 +1,42 @@
|
|
1
|
+
module NewRelic
|
2
|
+
class MetricData
|
3
|
+
attr_accessor :metric_spec
|
4
|
+
attr_accessor :metric_id
|
5
|
+
attr_accessor :stats
|
6
|
+
|
7
|
+
def initialize(metric_spec, stats, metric_id)
|
8
|
+
@metric_spec = metric_spec
|
9
|
+
self.stats = stats
|
10
|
+
self.metric_id = metric_id
|
11
|
+
end
|
12
|
+
|
13
|
+
def eql?(o)
|
14
|
+
(metric_spec.eql? o.metric_spec) && (stats.eql? o.stats)
|
15
|
+
end
|
16
|
+
|
17
|
+
def original_spec
|
18
|
+
@original_spec || @metric_spec
|
19
|
+
end
|
20
|
+
def metric_spec
|
21
|
+
@metric_spec
|
22
|
+
end
|
23
|
+
def metric_spec= new_spec
|
24
|
+
@original_spec = @metric_spec if @metric_spec
|
25
|
+
@metric_spec = new_spec
|
26
|
+
end
|
27
|
+
|
28
|
+
def hash
|
29
|
+
metric_spec.hash ^ stats.hash
|
30
|
+
end
|
31
|
+
|
32
|
+
# Serialize with all attributes, but if the metric id is not nil, then don't send the metric spec
|
33
|
+
def to_json(*a)
|
34
|
+
%Q[{"metric_spec":#{metric_id ? 'null' : metric_spec.to_json},"stats":{"total_exclusive_time":#{stats.total_exclusive_time},"min_call_time":#{stats.min_call_time},"call_count":#{stats.call_count},"sum_of_squares":#{stats.sum_of_squares},"total_call_time":#{stats.total_call_time},"max_call_time":#{stats.max_call_time}},"metric_id":#{metric_id ? metric_id : 'null'}}]
|
35
|
+
end
|
36
|
+
|
37
|
+
def to_s
|
38
|
+
"#{metric_spec.name}(#{metric_spec.scope}): #{stats}" if metric_spec
|
39
|
+
"#{metric_id}: #{stats}" if metric_spec.nil?
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,136 @@
|
|
1
|
+
module NewRelic
|
2
|
+
# Metric parsing logic mixin. Given a metric name (attribute called "name"), provide a set of accessors
|
3
|
+
# that enable inspection of the metric. A metric has 2 or more segments, each separated
|
4
|
+
# by the '/' character. The metric's category is specified by its first segment. Following
|
5
|
+
# are the set of categories currently supported by NewRelic's default metric set:
|
6
|
+
#
|
7
|
+
# * Controller
|
8
|
+
# * ActiveRecord
|
9
|
+
# * Rails
|
10
|
+
# * WebService
|
11
|
+
# * View
|
12
|
+
# * Database
|
13
|
+
# * Custom
|
14
|
+
#
|
15
|
+
# Based on the category of the metric, specific parsing logic is defined in the source files
|
16
|
+
# countained in the "metric_parsers" sub directory local to this file.
|
17
|
+
#
|
18
|
+
|
19
|
+
class MetricParser
|
20
|
+
|
21
|
+
SEPARATOR = '/' unless defined? SEPARATOR
|
22
|
+
attr_reader :name
|
23
|
+
|
24
|
+
# Load in the parsers classes in the plugin:
|
25
|
+
Dir[File.join(File.dirname(__FILE__), "metric_parser", "*.rb")].each { | file | require file }
|
26
|
+
|
27
|
+
# return a string that is parsable via the Metric parser APIs
|
28
|
+
def self.for_metric_named(s)
|
29
|
+
category = (s =~ /^([^\/]*)/) && $1
|
30
|
+
parser_class = self
|
31
|
+
if category
|
32
|
+
parser_class = NewRelic::MetricParser.const_get(category) if (NewRelic::MetricParser.const_defined?(category) rescue nil)
|
33
|
+
end
|
34
|
+
parser_class.new s
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.parse(s)
|
38
|
+
for_metric_named(s)
|
39
|
+
end
|
40
|
+
|
41
|
+
def method_missing(method_name, *args)
|
42
|
+
return false if method_name.to_s =~ /^is_.*\?/
|
43
|
+
super
|
44
|
+
end
|
45
|
+
# The short name for the metric is defined as all of the segments
|
46
|
+
# of the metric name except for its first (its domain).
|
47
|
+
def short_name
|
48
|
+
if segments.empty?
|
49
|
+
''
|
50
|
+
elsif segments.length == 1
|
51
|
+
segments[0]
|
52
|
+
else
|
53
|
+
segments[1..-1].join(SEPARATOR)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def pie_chart_label
|
58
|
+
developer_name
|
59
|
+
end
|
60
|
+
|
61
|
+
def developer_name
|
62
|
+
short_name
|
63
|
+
end
|
64
|
+
|
65
|
+
def tooltip_name
|
66
|
+
short_name
|
67
|
+
end
|
68
|
+
|
69
|
+
def apdex_metric_path
|
70
|
+
%Q[Apdex/#{segments[1..-1].join('/')}]
|
71
|
+
end
|
72
|
+
|
73
|
+
# A short name for legends in the graphs
|
74
|
+
def legend_name
|
75
|
+
short_name
|
76
|
+
end
|
77
|
+
|
78
|
+
# Return the name of another metric if the current
|
79
|
+
# metric is really add-on data for another metric.
|
80
|
+
def base_metric_name
|
81
|
+
nil
|
82
|
+
end
|
83
|
+
|
84
|
+
# Category is a UI description of the general
|
85
|
+
# category of metrics for this metric.
|
86
|
+
def category
|
87
|
+
segments[0]
|
88
|
+
end
|
89
|
+
|
90
|
+
def segments
|
91
|
+
return [] if !name
|
92
|
+
@segments ||= name.split(SEPARATOR).freeze
|
93
|
+
end
|
94
|
+
|
95
|
+
# --
|
96
|
+
# These accessors are used to allow chart to use a specific segment in the metric
|
97
|
+
# name for label construction as a zero-arg accessor
|
98
|
+
# ++
|
99
|
+
def segment_0; segments[0]; end
|
100
|
+
def segment_1; segments[1]; end
|
101
|
+
def segment_2; segments[2]; end
|
102
|
+
def segment_3; segments[3]; end
|
103
|
+
def segment_4; segments[4]; end
|
104
|
+
def segment_5; segments[5]; end
|
105
|
+
def last_segment; segments.last; end
|
106
|
+
|
107
|
+
# This is the suffix used for call rate or throughput. By default, it's cpm
|
108
|
+
# but things like controller actions will override to use something like 'rpm'
|
109
|
+
# for requests per minute
|
110
|
+
def call_rate_suffix
|
111
|
+
'cpm'
|
112
|
+
end
|
113
|
+
|
114
|
+
def url
|
115
|
+
''
|
116
|
+
end
|
117
|
+
# Return the list of dispatcher metrics that correspond to this metric. That is,
|
118
|
+
# the summary metrics which should also be recorded when this metric is recorded.
|
119
|
+
def summary_metrics
|
120
|
+
[]
|
121
|
+
end
|
122
|
+
# returns a hash of params for url_for(), giving you a drilldown URL to an RPM page for this metric
|
123
|
+
# define in subclasses - TB 2009-12-18
|
124
|
+
# def drilldown_url(metric_id); end
|
125
|
+
|
126
|
+
def initialize(name)
|
127
|
+
@name = name
|
128
|
+
end
|
129
|
+
|
130
|
+
# These would be reflected properly by method missing; consider
|
131
|
+
# this an optimization
|
132
|
+
def is_controller?; false; end
|
133
|
+
def is_transaction?; false; end
|
134
|
+
|
135
|
+
end
|
136
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
class NewRelic::MetricParser::ActiveMerchant < NewRelic::MetricParser
|
2
|
+
|
3
|
+
def is_active_merchant?; true; end
|
4
|
+
|
5
|
+
def is_active_merchant_gateway?
|
6
|
+
segments[1] == 'gateway'
|
7
|
+
end
|
8
|
+
|
9
|
+
def is_active_merchant_operation?
|
10
|
+
segments[1] == 'operation'
|
11
|
+
end
|
12
|
+
|
13
|
+
def gateway_name
|
14
|
+
# ends in "Gateway" - trim that off
|
15
|
+
segments[2][0..-8].titleize
|
16
|
+
end
|
17
|
+
|
18
|
+
def operation_name
|
19
|
+
segments[2]
|
20
|
+
end
|
21
|
+
|
22
|
+
def short_name
|
23
|
+
segments[2]
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
class NewRelic::MetricParser::ActiveRecord < NewRelic::MetricParser
|
2
|
+
def is_active_record? ; true; end
|
3
|
+
|
4
|
+
def model_class
|
5
|
+
return segments[1]
|
6
|
+
end
|
7
|
+
|
8
|
+
def is_database?
|
9
|
+
true
|
10
|
+
end
|
11
|
+
def legend_name
|
12
|
+
if name == 'ActiveRecord/all'
|
13
|
+
'Database'
|
14
|
+
else
|
15
|
+
super
|
16
|
+
end
|
17
|
+
end
|
18
|
+
def tooltip_name
|
19
|
+
if name == 'ActiveRecord/all'
|
20
|
+
'all SQL execution'
|
21
|
+
else
|
22
|
+
super
|
23
|
+
end
|
24
|
+
end
|
25
|
+
def developer_name
|
26
|
+
"#{model_class}##{segments.last}"
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
require 'new_relic/metric_parser'
|
2
|
+
module NewRelic
|
3
|
+
class MetricParser
|
4
|
+
class Apdex < NewRelic::MetricParser
|
5
|
+
|
6
|
+
CLIENT = 'Client'
|
7
|
+
|
8
|
+
# Convenience method for creating the appropriate client
|
9
|
+
# metric name.
|
10
|
+
def self.client_metric(apdex_t)
|
11
|
+
"Apdex/#{CLIENT}/#{apdex_t}"
|
12
|
+
end
|
13
|
+
def self.browser_client_metric(os, browser, version, apdex_t)
|
14
|
+
"#{self.client_metric(apdex_t)}/#{os}/#{browser}/#{version}"
|
15
|
+
end
|
16
|
+
|
17
|
+
def is_client?
|
18
|
+
segments[1] == CLIENT
|
19
|
+
end
|
20
|
+
def is_client_summary?
|
21
|
+
is_client? && segments.size == 3
|
22
|
+
end
|
23
|
+
def is_browser_summary?
|
24
|
+
is_client? && segments.size == 6
|
25
|
+
end
|
26
|
+
def is_summary?
|
27
|
+
segments.size == 1
|
28
|
+
end
|
29
|
+
|
30
|
+
# Apdex/Client/N
|
31
|
+
def apdex_t
|
32
|
+
is_client? && segments[2].to_f
|
33
|
+
end
|
34
|
+
|
35
|
+
def platform
|
36
|
+
is_browser_summary? && segments[3]
|
37
|
+
end
|
38
|
+
|
39
|
+
def browser
|
40
|
+
is_browser_summary? && segments[4]
|
41
|
+
end
|
42
|
+
|
43
|
+
def browser_version
|
44
|
+
is_browser_summary? && segments[5]
|
45
|
+
end
|
46
|
+
|
47
|
+
def user_agent
|
48
|
+
is_browser_summary? && segments[4..-1].join(" ")
|
49
|
+
end
|
50
|
+
|
51
|
+
def platform_and_user_agent
|
52
|
+
is_browser_summary? && segments[3..-1].join(" ")
|
53
|
+
end
|
54
|
+
|
55
|
+
def developer_name
|
56
|
+
case
|
57
|
+
when is_client? then "Apdex Client (#{apdex_t})"
|
58
|
+
when is_browser_summary? then "Apdex Client for #{os_and_browser} (#{apdex_t})"
|
59
|
+
when is_summary? then "Apdex"
|
60
|
+
else "Apdex #{segments[1..-1].join("/")}"
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def short_name
|
65
|
+
# standard controller actions
|
66
|
+
if segments.length > 1
|
67
|
+
url
|
68
|
+
else
|
69
|
+
'All Frontend Urls'
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def url
|
74
|
+
'/' + segments[1..-1].join('/')
|
75
|
+
end
|
76
|
+
|
77
|
+
# this is used to match transaction traces to controller actions.
|
78
|
+
# TT's don't have a preceding slash :P
|
79
|
+
def tt_path
|
80
|
+
segments[1..-1].join('/')
|
81
|
+
end
|
82
|
+
|
83
|
+
def call_rate_suffix
|
84
|
+
'rpm'
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
class NewRelic::MetricParser::Controller < NewRelic::MetricParser
|
2
|
+
|
3
|
+
def is_controller?; true; end
|
4
|
+
def is_transaction?; true; end
|
5
|
+
|
6
|
+
# If the controller name segments look like a file path, convert it to the controller
|
7
|
+
# class name. If it begins with a capital letter, assume it's already a class name.
|
8
|
+
# We only expect a lower case letter with Rails, so we'll be able to use camelize for
|
9
|
+
# that.
|
10
|
+
def controller_name
|
11
|
+
path = segments[1..-2].join('/')
|
12
|
+
path < 'a' ? path : path.camelize+"Controller"
|
13
|
+
end
|
14
|
+
|
15
|
+
def action_name
|
16
|
+
if segments[-1] =~ /^\(other\)$/
|
17
|
+
'(template only)'
|
18
|
+
else
|
19
|
+
segments[-1]
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def developer_name
|
24
|
+
"#{controller_name}##{action_name}"
|
25
|
+
end
|
26
|
+
|
27
|
+
def is_web_transaction?
|
28
|
+
true
|
29
|
+
end
|
30
|
+
# return the cpu measuring equivalent. It may be nil since this metric was not
|
31
|
+
# present in earlier versions of the agent.
|
32
|
+
def cpu_metric
|
33
|
+
Metric.lookup((["ControllerCPU"] + segments[1..-1]).join('/'), :create => false)
|
34
|
+
end
|
35
|
+
|
36
|
+
def short_name
|
37
|
+
# standard controller actions
|
38
|
+
if segments.length > 1
|
39
|
+
url
|
40
|
+
else
|
41
|
+
'All Controller Actions'
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def url
|
46
|
+
'/' + segments[1..-1].join('/')
|
47
|
+
end
|
48
|
+
|
49
|
+
# this is used to match transaction traces to controller actions.
|
50
|
+
# TT's don't have a preceding slash :P
|
51
|
+
def tt_path
|
52
|
+
segments[1..-1].join('/')
|
53
|
+
end
|
54
|
+
|
55
|
+
def call_rate_suffix
|
56
|
+
'rpm'
|
57
|
+
end
|
58
|
+
|
59
|
+
def summary_metrics
|
60
|
+
%w[HttpDispatcher]
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
class NewRelic::MetricParser::ControllerCPU < NewRelic::MetricParser
|
2
|
+
|
3
|
+
def is_controller_cpu?; true; end
|
4
|
+
|
5
|
+
def controller_name
|
6
|
+
segments[1..-2].join('/').camelize+"Controller"
|
7
|
+
end
|
8
|
+
|
9
|
+
def action_name
|
10
|
+
segments[-1]
|
11
|
+
end
|
12
|
+
|
13
|
+
def developer_name
|
14
|
+
"#{controller_name}##{action_name}"
|
15
|
+
end
|
16
|
+
|
17
|
+
def base_metric_name
|
18
|
+
"Controller/" + segments[1..-1].join('/')
|
19
|
+
end
|
20
|
+
|
21
|
+
def short_name
|
22
|
+
# standard controller actions
|
23
|
+
if segments.length > 1
|
24
|
+
url
|
25
|
+
else
|
26
|
+
'All Controller Actions'
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def url
|
31
|
+
'/' + segments[1..-1].join('/')
|
32
|
+
end
|
33
|
+
|
34
|
+
def call_rate_suffix
|
35
|
+
'rpm'
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|