newrelic_rpm 2.13.0.beta5 → 2.13.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of newrelic_rpm might be problematic. Click here for more details.
- data/CHANGELOG +4 -0
- data/lib/new_relic/agent.rb +50 -50
- data/lib/new_relic/agent/agent.rb +24 -19
- data/lib/new_relic/agent/busy_calculator.rb +22 -22
- data/lib/new_relic/agent/chained_call.rb +3 -3
- data/lib/new_relic/agent/error_collector.rb +19 -19
- data/lib/new_relic/agent/instrumentation/active_record_instrumentation.rb +11 -11
- data/lib/new_relic/agent/instrumentation/acts_as_solr.rb +2 -2
- data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +43 -43
- data/lib/new_relic/agent/instrumentation/data_mapper.rb +6 -6
- data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +2 -2
- data/lib/new_relic/agent/instrumentation/memcache.rb +8 -8
- data/lib/new_relic/agent/instrumentation/merb/controller.rb +4 -4
- data/lib/new_relic/agent/instrumentation/metric_frame.rb +307 -303
- data/lib/new_relic/agent/instrumentation/passenger_instrumentation.rb +8 -8
- data/lib/new_relic/agent/instrumentation/rack.rb +2 -2
- data/lib/new_relic/agent/instrumentation/rails/action_controller.rb +10 -10
- data/lib/new_relic/agent/instrumentation/rails/action_web_service.rb +3 -3
- data/lib/new_relic/agent/instrumentation/rails/errors.rb +5 -5
- data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +5 -5
- data/lib/new_relic/agent/instrumentation/sinatra.rb +5 -5
- data/lib/new_relic/agent/instrumentation/sunspot.rb +1 -1
- data/lib/new_relic/agent/method_tracer.rb +55 -55
- data/lib/new_relic/agent/sampler.rb +42 -38
- data/lib/new_relic/agent/samplers/cpu_sampler.rb +4 -4
- data/lib/new_relic/agent/samplers/delayed_job_lock_sampler.rb +7 -7
- data/lib/new_relic/agent/samplers/memory_sampler.rb +11 -11
- data/lib/new_relic/agent/samplers/object_sampler.rb +1 -1
- data/lib/new_relic/agent/shim_agent.rb +20 -16
- data/lib/new_relic/agent/stats_engine.rb +3 -3
- data/lib/new_relic/agent/stats_engine/metric_stats.rb +28 -28
- data/lib/new_relic/agent/stats_engine/samplers.rb +16 -16
- data/lib/new_relic/agent/stats_engine/transactions.rb +25 -25
- data/lib/new_relic/agent/transaction_sampler.rb +68 -69
- data/lib/new_relic/agent/worker_loop.rb +13 -13
- data/lib/new_relic/collection_helper.rb +6 -6
- data/lib/new_relic/command.rb +14 -14
- data/lib/new_relic/commands/deployments.rb +19 -19
- data/lib/new_relic/commands/install.rb +25 -15
- data/lib/new_relic/control.rb +25 -25
- data/lib/new_relic/control/configuration.rb +17 -17
- data/lib/new_relic/control/frameworks/external.rb +3 -3
- data/lib/new_relic/control/frameworks/merb.rb +6 -6
- data/lib/new_relic/control/frameworks/rails.rb +17 -17
- data/lib/new_relic/control/frameworks/rails3.rb +11 -27
- data/lib/new_relic/control/frameworks/ruby.rb +6 -6
- data/lib/new_relic/control/frameworks/sinatra.rb +4 -4
- data/lib/new_relic/control/instrumentation.rb +8 -8
- data/lib/new_relic/control/logging_methods.rb +13 -13
- data/lib/new_relic/control/profiling.rb +2 -2
- data/lib/new_relic/control/server_methods.rb +17 -17
- data/lib/new_relic/delayed_job_injection.rb +1 -1
- data/lib/new_relic/histogram.rb +73 -71
- data/lib/new_relic/local_environment.rb +45 -45
- data/lib/new_relic/merbtasks.rb +1 -1
- data/lib/new_relic/metric_data.rb +5 -5
- data/lib/new_relic/metric_parser.rb +22 -22
- data/lib/new_relic/metric_parser/action_mailer.rb +4 -4
- data/lib/new_relic/metric_parser/active_merchant.rb +8 -8
- data/lib/new_relic/metric_parser/active_record.rb +2 -2
- data/lib/new_relic/metric_parser/apdex.rb +86 -51
- data/lib/new_relic/metric_parser/controller.rb +10 -10
- data/lib/new_relic/metric_parser/controller_cpu.rb +5 -5
- data/lib/new_relic/metric_parser/errors.rb +1 -1
- data/lib/new_relic/metric_parser/external.rb +3 -3
- data/lib/new_relic/metric_parser/mem_cache.rb +2 -2
- data/lib/new_relic/metric_parser/other_transaction.rb +7 -7
- data/lib/new_relic/metric_parser/view.rb +5 -5
- data/lib/new_relic/metric_parser/web_frontend.rb +1 -1
- data/lib/new_relic/metric_parser/web_service.rb +1 -1
- data/lib/new_relic/metric_spec.rb +13 -13
- data/lib/new_relic/noticed_error.rb +4 -4
- data/lib/new_relic/rack/developer_mode.rb +33 -33
- data/lib/new_relic/rack/metric_app.rb +2 -2
- data/lib/new_relic/recipes.rb +9 -9
- data/lib/new_relic/stats.rb +57 -57
- data/lib/new_relic/timer_lib.rb +2 -2
- data/lib/new_relic/transaction_analysis.rb +19 -19
- data/lib/new_relic/transaction_sample.rb +101 -101
- data/lib/new_relic/url_rule.rb +3 -3
- data/lib/new_relic/version.rb +10 -10
- data/lib/newrelic_rpm.rb +6 -4
- data/lib/tasks/all.rb +1 -1
- data/newrelic_rpm.gemspec +3 -3
- data/test/new_relic/rack/episodes_test.rb +1 -0
- metadata +24 -42
data/lib/new_relic/merbtasks.rb
CHANGED
@@ -3,13 +3,13 @@ module NewRelic
|
|
3
3
|
attr_accessor :metric_spec
|
4
4
|
attr_accessor :metric_id
|
5
5
|
attr_accessor :stats
|
6
|
-
|
6
|
+
|
7
7
|
def initialize(metric_spec, stats, metric_id)
|
8
8
|
@metric_spec = metric_spec
|
9
9
|
self.stats = stats
|
10
10
|
self.metric_id = metric_id
|
11
11
|
end
|
12
|
-
|
12
|
+
|
13
13
|
def eql?(o)
|
14
14
|
(metric_spec.eql? o.metric_spec) && (stats.eql? o.stats)
|
15
15
|
end
|
@@ -24,16 +24,16 @@ module NewRelic
|
|
24
24
|
@original_spec = @metric_spec if @metric_spec
|
25
25
|
@metric_spec = new_spec
|
26
26
|
end
|
27
|
-
|
27
|
+
|
28
28
|
def hash
|
29
29
|
metric_spec.hash ^ stats.hash
|
30
30
|
end
|
31
|
-
|
31
|
+
|
32
32
|
# Serialize with all attributes, but if the metric id is not nil, then don't send the metric spec
|
33
33
|
def to_json(*a)
|
34
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
35
|
end
|
36
|
-
|
36
|
+
|
37
37
|
def to_s
|
38
38
|
"#{metric_spec.name}(#{metric_spec.scope}): #{stats}" if metric_spec
|
39
39
|
"#{metric_id}: #{stats}" if metric_spec.nil?
|
@@ -15,15 +15,15 @@ module NewRelic
|
|
15
15
|
# Based on the category of the metric, specific parsing logic is defined in the source files
|
16
16
|
# countained in the "metric_parsers" sub directory local to this file.
|
17
17
|
#
|
18
|
-
|
18
|
+
|
19
19
|
class MetricParser
|
20
|
-
|
20
|
+
|
21
21
|
SEPARATOR = '/' unless defined? SEPARATOR
|
22
22
|
attr_reader :name
|
23
|
-
|
23
|
+
|
24
24
|
# Load in the parsers classes in the plugin:
|
25
25
|
Dir[File.join(File.dirname(__FILE__), "metric_parser", "*.rb")].each { | file | require file }
|
26
|
-
|
26
|
+
|
27
27
|
# return a string that is parsable via the Metric parser APIs
|
28
28
|
def self.for_metric_named(s)
|
29
29
|
category = (s =~ /^([^\/]*)/) && $1
|
@@ -37,7 +37,7 @@ module NewRelic
|
|
37
37
|
def self.parse(s)
|
38
38
|
for_metric_named(s)
|
39
39
|
end
|
40
|
-
|
40
|
+
|
41
41
|
def method_missing(method_name, *args)
|
42
42
|
return false if method_name.to_s =~ /^is_.*\?/
|
43
43
|
super
|
@@ -53,45 +53,45 @@ module NewRelic
|
|
53
53
|
segments[1..-1].join(SEPARATOR)
|
54
54
|
end
|
55
55
|
end
|
56
|
-
|
56
|
+
|
57
57
|
def pie_chart_label
|
58
58
|
developer_name
|
59
59
|
end
|
60
|
-
|
60
|
+
|
61
61
|
def developer_name
|
62
62
|
short_name
|
63
63
|
end
|
64
|
-
|
64
|
+
|
65
65
|
def tooltip_name
|
66
66
|
short_name
|
67
67
|
end
|
68
|
-
|
68
|
+
|
69
69
|
def apdex_metric_path
|
70
70
|
%Q[Apdex/#{segments[1..-1].join('/')}]
|
71
71
|
end
|
72
|
-
|
72
|
+
|
73
73
|
# A short name for legends in the graphs
|
74
74
|
def legend_name
|
75
75
|
short_name
|
76
76
|
end
|
77
|
-
|
77
|
+
|
78
78
|
# Return the name of another metric if the current
|
79
79
|
# metric is really add-on data for another metric.
|
80
80
|
def base_metric_name
|
81
81
|
nil
|
82
82
|
end
|
83
|
-
|
84
|
-
# Category is a UI description of the general
|
83
|
+
|
84
|
+
# Category is a UI description of the general
|
85
85
|
# category of metrics for this metric.
|
86
86
|
def category
|
87
87
|
segments[0]
|
88
88
|
end
|
89
|
-
|
89
|
+
|
90
90
|
def segments
|
91
91
|
return [] if !name
|
92
92
|
@segments ||= name.split(SEPARATOR).freeze
|
93
93
|
end
|
94
|
-
|
94
|
+
|
95
95
|
# --
|
96
96
|
# These accessors are used to allow chart to use a specific segment in the metric
|
97
97
|
# name for label construction as a zero-arg accessor
|
@@ -103,18 +103,18 @@ module NewRelic
|
|
103
103
|
def segment_4; segments[4]; end
|
104
104
|
def segment_5; segments[5]; end
|
105
105
|
def last_segment; segments.last; end
|
106
|
-
|
106
|
+
|
107
107
|
# This is the suffix used for call rate or throughput. By default, it's cpm
|
108
108
|
# but things like controller actions will override to use something like 'rpm'
|
109
109
|
# for requests per minute
|
110
110
|
def call_rate_suffix
|
111
111
|
'cpm'
|
112
112
|
end
|
113
|
-
|
113
|
+
|
114
114
|
def url
|
115
115
|
''
|
116
116
|
end
|
117
|
-
# Return the list of dispatcher metrics that correspond to this metric. That is,
|
117
|
+
# Return the list of dispatcher metrics that correspond to this metric. That is,
|
118
118
|
# the summary metrics which should also be recorded when this metric is recorded.
|
119
119
|
def summary_metrics
|
120
120
|
[]
|
@@ -122,15 +122,15 @@ module NewRelic
|
|
122
122
|
# returns a hash of params for url_for(), giving you a drilldown URL to an RPM page for this metric
|
123
123
|
# define in subclasses - TB 2009-12-18
|
124
124
|
# def drilldown_url(metric_id); end
|
125
|
-
|
125
|
+
|
126
126
|
def initialize(name)
|
127
127
|
@name = name
|
128
128
|
end
|
129
|
-
|
129
|
+
|
130
130
|
# These would be reflected properly by method missing; consider
|
131
131
|
# this an optimization
|
132
132
|
def is_controller?; false; end
|
133
133
|
def is_transaction?; false; end
|
134
|
-
|
135
|
-
end
|
134
|
+
|
135
|
+
end
|
136
136
|
end
|
@@ -1,26 +1,26 @@
|
|
1
1
|
class NewRelic::MetricParser::ActiveMerchant < NewRelic::MetricParser
|
2
|
-
|
2
|
+
|
3
3
|
def is_active_merchant?; true; end
|
4
|
-
|
4
|
+
|
5
5
|
def is_active_merchant_gateway?
|
6
6
|
segments[1] == 'gateway'
|
7
7
|
end
|
8
|
-
|
8
|
+
|
9
9
|
def is_active_merchant_operation?
|
10
10
|
segments[1] == 'operation'
|
11
11
|
end
|
12
|
-
|
12
|
+
|
13
13
|
def gateway_name
|
14
14
|
# ends in "Gateway" - trim that off
|
15
15
|
segments[2][0..-8].titleize
|
16
16
|
end
|
17
|
-
|
17
|
+
|
18
18
|
def operation_name
|
19
19
|
segments[2]
|
20
20
|
end
|
21
|
-
|
21
|
+
|
22
22
|
def short_name
|
23
23
|
segments[2]
|
24
24
|
end
|
25
|
-
|
26
|
-
end
|
25
|
+
|
26
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class NewRelic::MetricParser::ActiveRecord < NewRelic::MetricParser
|
2
2
|
def is_active_record? ; true; end
|
3
|
-
|
3
|
+
|
4
4
|
def model_class
|
5
5
|
return segments[1]
|
6
6
|
end
|
@@ -25,4 +25,4 @@ class NewRelic::MetricParser::ActiveRecord < NewRelic::MetricParser
|
|
25
25
|
def developer_name
|
26
26
|
"#{model_class}##{segments.last}"
|
27
27
|
end
|
28
|
-
end
|
28
|
+
end
|
@@ -1,53 +1,88 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
end
|
17
|
-
|
18
|
-
# Apdex/Client/N
|
19
|
-
def apdex_t
|
20
|
-
is_client? && segments[2].to_f
|
21
|
-
end
|
22
|
-
|
23
|
-
def developer_name
|
24
|
-
case
|
25
|
-
when is_client? then "Apdex Client (#{apdex_t})"
|
26
|
-
when is_summary? then "Apdex"
|
27
|
-
else "Apdex #{segments[1..-1].join("/")}"
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
def short_name
|
32
|
-
# standard controller actions
|
33
|
-
if segments.length > 1
|
34
|
-
url
|
35
|
-
else
|
36
|
-
'All Frontend Urls'
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
def url
|
41
|
-
'/' + segments[1..-1].join('/')
|
42
|
-
end
|
43
|
-
|
44
|
-
# this is used to match transaction traces to controller actions.
|
45
|
-
# TT's don't have a preceding slash :P
|
46
|
-
def tt_path
|
47
|
-
segments[1..-1].join('/')
|
48
|
-
end
|
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
|
49
16
|
|
50
|
-
|
51
|
-
|
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
|
52
87
|
end
|
53
|
-
end
|
88
|
+
end
|
@@ -5,11 +5,11 @@ class NewRelic::MetricParser::Controller < NewRelic::MetricParser
|
|
5
5
|
|
6
6
|
# If the controller name segments look like a file path, convert it to the controller
|
7
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
|
8
|
+
# We only expect a lower case letter with Rails, so we'll be able to use camelize for
|
9
9
|
# that.
|
10
10
|
def controller_name
|
11
11
|
path = segments[1..-2].join('/')
|
12
|
-
path < 'a' ? path : path.camelize+"Controller"
|
12
|
+
path < 'a' ? path : path.camelize+"Controller"
|
13
13
|
end
|
14
14
|
|
15
15
|
def action_name
|
@@ -19,11 +19,11 @@ class NewRelic::MetricParser::Controller < NewRelic::MetricParser
|
|
19
19
|
segments[-1]
|
20
20
|
end
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
23
|
def developer_name
|
24
24
|
"#{controller_name}##{action_name}"
|
25
25
|
end
|
26
|
-
|
26
|
+
|
27
27
|
def is_web_transaction?
|
28
28
|
true
|
29
29
|
end
|
@@ -32,7 +32,7 @@ class NewRelic::MetricParser::Controller < NewRelic::MetricParser
|
|
32
32
|
def cpu_metric
|
33
33
|
Metric.lookup((["ControllerCPU"] + segments[1..-1]).join('/'), :create => false)
|
34
34
|
end
|
35
|
-
|
35
|
+
|
36
36
|
def short_name
|
37
37
|
# standard controller actions
|
38
38
|
if segments.length > 1
|
@@ -41,12 +41,12 @@ class NewRelic::MetricParser::Controller < NewRelic::MetricParser
|
|
41
41
|
'All Controller Actions'
|
42
42
|
end
|
43
43
|
end
|
44
|
-
|
44
|
+
|
45
45
|
def url
|
46
46
|
'/' + segments[1..-1].join('/')
|
47
47
|
end
|
48
|
-
|
49
|
-
# this is used to match transaction traces to controller actions.
|
48
|
+
|
49
|
+
# this is used to match transaction traces to controller actions.
|
50
50
|
# TT's don't have a preceding slash :P
|
51
51
|
def tt_path
|
52
52
|
segments[1..-1].join('/')
|
@@ -55,8 +55,8 @@ class NewRelic::MetricParser::Controller < NewRelic::MetricParser
|
|
55
55
|
def call_rate_suffix
|
56
56
|
'rpm'
|
57
57
|
end
|
58
|
-
|
58
|
+
|
59
59
|
def summary_metrics
|
60
60
|
%w[HttpDispatcher]
|
61
61
|
end
|
62
|
-
end
|
62
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
class NewRelic::MetricParser::ControllerCPU < NewRelic::MetricParser
|
2
|
-
|
2
|
+
|
3
3
|
def is_controller_cpu?; true; end
|
4
|
-
|
4
|
+
|
5
5
|
def controller_name
|
6
6
|
segments[1..-2].join('/').camelize+"Controller"
|
7
7
|
end
|
@@ -17,7 +17,7 @@ class NewRelic::MetricParser::ControllerCPU < NewRelic::MetricParser
|
|
17
17
|
def base_metric_name
|
18
18
|
"Controller/" + segments[1..-1].join('/')
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
def short_name
|
22
22
|
# standard controller actions
|
23
23
|
if segments.length > 1
|
@@ -26,7 +26,7 @@ class NewRelic::MetricParser::ControllerCPU < NewRelic::MetricParser
|
|
26
26
|
'All Controller Actions'
|
27
27
|
end
|
28
28
|
end
|
29
|
-
|
29
|
+
|
30
30
|
def url
|
31
31
|
'/' + segments[1..-1].join('/')
|
32
32
|
end
|
@@ -35,4 +35,4 @@ class NewRelic::MetricParser::ControllerCPU < NewRelic::MetricParser
|
|
35
35
|
'rpm'
|
36
36
|
end
|
37
37
|
|
38
|
-
end
|
38
|
+
end
|