newrelic_rpm 2.13.3 → 2.13.4.eum1
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 +7 -0
- data/README.rdoc +2 -0
- data/lib/new_relic/agent.rb +17 -0
- data/lib/new_relic/agent/agent.rb +9 -0
- data/lib/new_relic/agent/browser_monitoring.rb +45 -0
- data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +1 -0
- data/lib/new_relic/agent/shim_agent.rb +2 -0
- data/lib/new_relic/control.rb +1 -1
- data/lib/new_relic/control/server_methods.rb +24 -14
- data/lib/new_relic/stats.rb +3 -0
- data/lib/new_relic/transaction_analysis.rb +1 -1
- data/lib/new_relic/version.rb +2 -2
- data/newrelic_rpm.gemspec +212 -212
- data/test/new_relic/control_test.rb +27 -2
- metadata +13 -15
- data/lib/new_relic_api.rb +0 -276
data/CHANGELOG
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
v2.13.4.eum1
|
2
|
+
* Add preliminary work on end user monitoring
|
3
|
+
* Moved the API helper to the gihtub newrelic_api gem.
|
4
|
+
|
5
|
+
v2.13.4
|
6
|
+
* Update DNS lookup code to remove hardcoded IP addresses
|
7
|
+
|
1
8
|
v2.13.3
|
2
9
|
* Dalli instrumentation from Mike Perham (thanks Mike)
|
3
10
|
* Datamapper instrumentation from Jordan Ritter (thanks Jordan)
|
data/README.rdoc
CHANGED
data/lib/new_relic/agent.rb
CHANGED
@@ -72,6 +72,7 @@ module NewRelic
|
|
72
72
|
require 'new_relic/timer_lib'
|
73
73
|
|
74
74
|
require 'new_relic/agent/chained_call'
|
75
|
+
require 'new_relic/agent/browser_monitoring'
|
75
76
|
require 'new_relic/agent/agent'
|
76
77
|
require 'new_relic/agent/shim_agent'
|
77
78
|
require 'new_relic/agent/method_tracer'
|
@@ -377,5 +378,21 @@ module NewRelic
|
|
377
378
|
def record_transaction(response_sec, options = {})
|
378
379
|
agent.record_transaction(response_sec, options)
|
379
380
|
end
|
381
|
+
|
382
|
+
# PRE-RELEASE
|
383
|
+
# Returns a Javascript string which should be injected into the very top of the response body
|
384
|
+
# == options
|
385
|
+
# * <tt>:protocol => 'http' or 'https'
|
386
|
+
#
|
387
|
+
def browser_instrumentation_header(options={})
|
388
|
+
agent.browser_instrumentation_header(options)
|
389
|
+
end
|
390
|
+
|
391
|
+
# PRE-RELEASE
|
392
|
+
# Returns a Javascript string which should be injected into the very bottom of the response body
|
393
|
+
#
|
394
|
+
def browser_instrumentation_footer(options={})
|
395
|
+
agent.browser_instrumentation_footer(options={})
|
396
|
+
end
|
380
397
|
end
|
381
398
|
end
|
@@ -61,6 +61,10 @@ module NewRelic
|
|
61
61
|
attr_reader :histogram
|
62
62
|
attr_reader :metric_ids
|
63
63
|
attr_reader :url_rules
|
64
|
+
attr_reader :browser_monitoring_key
|
65
|
+
attr_reader :application_id
|
66
|
+
attr_reader :beacon
|
67
|
+
attr_reader :episodes_file
|
64
68
|
|
65
69
|
def record_transaction(duration_seconds, options={})
|
66
70
|
is_error = options['is_error'] || options['error_message'] || options['exception']
|
@@ -433,6 +437,10 @@ module NewRelic
|
|
433
437
|
@agent_id = connect_data['agent_run_id']
|
434
438
|
@report_period = connect_data['data_report_period']
|
435
439
|
@url_rules = connect_data['url_rules']
|
440
|
+
@browser_monitoring_key = connect_data['browser_key']
|
441
|
+
@application_id = connect_data['application_id']
|
442
|
+
@beacon = connect_data['beacon']
|
443
|
+
@episodes_file = connect_data['episodes_file']
|
436
444
|
|
437
445
|
control.log! "Connected to NewRelic Service at #{@collector}"
|
438
446
|
log.debug "Agent Run = #{@agent_id}."
|
@@ -736,6 +744,7 @@ module NewRelic
|
|
736
744
|
|
737
745
|
extend ClassMethods
|
738
746
|
include InstanceMethods
|
747
|
+
include BrowserMonitoring
|
739
748
|
end
|
740
749
|
end
|
741
750
|
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module NewRelic
|
2
|
+
module Agent
|
3
|
+
module BrowserMonitoring
|
4
|
+
def browser_instrumentation_header(options={})
|
5
|
+
|
6
|
+
options = {:protocol => 'https'}.merge(options)
|
7
|
+
|
8
|
+
license_key = NewRelic::Agent.instance.browser_monitoring_key
|
9
|
+
|
10
|
+
return "" if license_key.nil?
|
11
|
+
|
12
|
+
application_id = NewRelic::Agent.instance.application_id
|
13
|
+
beacon = NewRelic::Agent.instance.beacon
|
14
|
+
episodes_file = NewRelic::Agent.instance.episodes_file
|
15
|
+
|
16
|
+
transaction_name = Thread::current[:newrelic_scope_name] || "<unknown>"
|
17
|
+
|
18
|
+
# Agents are hard-coded to a particular episodes JS file. This allows for radical future change
|
19
|
+
# to the contents of that file
|
20
|
+
file = "\"#{options[:protocol]}://#{episodes_file}\""
|
21
|
+
|
22
|
+
<<-eos
|
23
|
+
<script src=#{file} type="text/javascript"></script><script type="text/javascript" charset="utf-8">NR_RUM.setContext("#{beacon}","#{license_key}","#{application_id}","#{transaction_name}")</script>
|
24
|
+
eos
|
25
|
+
end
|
26
|
+
|
27
|
+
def browser_instrumentation_footer(options={})
|
28
|
+
|
29
|
+
return "" if NewRelic::Agent.instance.browser_monitoring_key.nil?
|
30
|
+
|
31
|
+
frame = Thread.current[:newrelic_metric_frame]
|
32
|
+
|
33
|
+
if frame && frame.start
|
34
|
+
# HACK ALERT - there's probably a better way for us to get the queue-time
|
35
|
+
queue_time = ((Thread.current[:queue_time] || 0).to_f * 1000.0).round
|
36
|
+
app_time = ((Time.now - frame.start).to_f * 1000.0).round
|
37
|
+
|
38
|
+
<<-eos
|
39
|
+
<script type="text/javascript" charset="utf-8">NR_RUM.recordFooter(#{queue_time},#{app_time})</script>
|
40
|
+
eos
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -394,6 +394,7 @@ module NewRelic
|
|
394
394
|
if http_entry_time
|
395
395
|
queue_stat = NewRelic::Agent.agent.stats_engine.get_stats_no_scope 'WebFrontend/Mongrel/Average Queue Time'
|
396
396
|
total_time = (now - http_entry_time)
|
397
|
+
Thread.current[:queue_time] = total_time # HACK ALERT - this is used to communicate with the browser monitoring code
|
397
398
|
queue_stat.trace_call(total_time.to_f) unless total_time.to_f <= 0.0 # using remote timestamps could lead to negative queue time
|
398
399
|
end
|
399
400
|
return http_entry_time ? Time.at(http_entry_time) : now
|
data/lib/new_relic/control.rb
CHANGED
@@ -34,27 +34,37 @@ module NewRelic
|
|
34
34
|
# if the host is not an IP address, turn it into one
|
35
35
|
NewRelic::Control::Server.new host, (self['port'] || (use_ssl? ? 443 : 80)).to_i, convert_to_ip_address(host)
|
36
36
|
end
|
37
|
-
|
38
|
-
#
|
39
|
-
#
|
40
|
-
#
|
41
|
-
#
|
37
|
+
|
38
|
+
# Check to see if we need to look up the IP address
|
39
|
+
# If it's an IP address already, we pass it through.
|
40
|
+
# If it's nil, or localhost, we don't bother.
|
41
|
+
# Otherwise, use `resolve_ip_address` to find one
|
42
42
|
def convert_to_ip_address(host)
|
43
43
|
# here we leave it as a host name since the cert verification
|
44
44
|
# needs it in host form
|
45
45
|
return host if verify_certificate?
|
46
46
|
return nil if host.nil? || host.downcase == "localhost"
|
47
|
-
|
48
|
-
|
47
|
+
ip = resolve_ip_address(host)
|
48
|
+
log.info "Resolved #{host} to #{ip}"
|
49
|
+
ip
|
50
|
+
end
|
51
|
+
|
52
|
+
# Look up the ip address of the host using the pure ruby lookup
|
53
|
+
# to prevent blocking. If that fails, fall back to the regular
|
54
|
+
# IPSocket library. Return nil if we can't find the host ip
|
55
|
+
# address and don't have a good default.
|
56
|
+
def resolve_ip_address(host)
|
57
|
+
Resolv.getaddress(host)
|
58
|
+
rescue Exception => e
|
59
|
+
log.warn("DNS Error caching IP address: #{e}")
|
60
|
+
log.debug(e.backtrace.join("\n "))
|
49
61
|
begin
|
50
|
-
|
51
|
-
|
52
|
-
rescue => e
|
53
|
-
log.
|
54
|
-
|
55
|
-
ip_address = IPSocket::getaddress host rescue ip_address
|
62
|
+
log.info("Trying native DNS lookup since Resolv failed")
|
63
|
+
IPSocket.getaddress(host)
|
64
|
+
rescue Exception => e
|
65
|
+
log.error("Could not look up server address: #{e}")
|
66
|
+
nil
|
56
67
|
end
|
57
|
-
ip_address
|
58
68
|
end
|
59
69
|
|
60
70
|
# Return the Net::HTTP with proxy configuration given the NewRelic::Control::Server object.
|
data/lib/new_relic/stats.rb
CHANGED
data/lib/new_relic/version.rb
CHANGED
@@ -3,8 +3,8 @@ module NewRelic
|
|
3
3
|
module VERSION #:nodoc:
|
4
4
|
MAJOR = 2
|
5
5
|
MINOR = 13
|
6
|
-
TINY =
|
7
|
-
BUILD =
|
6
|
+
TINY = 4
|
7
|
+
BUILD = 'eum1' #'0' # Set to nil for a release, 'beta1', 'alpha', etc for prerelease builds
|
8
8
|
STRING = [MAJOR, MINOR, TINY, BUILD].compact.join('.')
|
9
9
|
end
|
10
10
|
|
data/newrelic_rpm.gemspec
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
# Generated by jeweler
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{newrelic_rpm}
|
8
|
-
s.version = "2.13.
|
8
|
+
s.version = "2.13.4.eum1"
|
9
9
|
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new("
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Bill Kayser", "Justin George"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2011-02-11}
|
13
13
|
s.description = %q{New Relic RPM is a Ruby performance management system, developed by
|
14
14
|
New Relic, Inc (http://www.newrelic.com). RPM provides you with deep
|
15
15
|
information about the performance of your Ruby on Rails or Merb
|
@@ -18,218 +18,218 @@ dual-purposed as a either a Rails plugin or a Gem, hosted on
|
|
18
18
|
http://github.com/newrelic/rpm/tree/master.
|
19
19
|
}
|
20
20
|
s.email = %q{support@newrelic.com}
|
21
|
-
s.executables = ["
|
21
|
+
s.executables = ["newrelic_cmd", "newrelic", "mongrel_rpm"]
|
22
22
|
s.extra_rdoc_files = [
|
23
23
|
"CHANGELOG",
|
24
|
-
|
25
|
-
|
26
|
-
|
24
|
+
"LICENSE",
|
25
|
+
"README.rdoc",
|
26
|
+
"newrelic.yml"
|
27
27
|
]
|
28
28
|
s.files = [
|
29
29
|
"CHANGELOG",
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
30
|
+
"LICENSE",
|
31
|
+
"README.rdoc",
|
32
|
+
"bin/mongrel_rpm",
|
33
|
+
"bin/newrelic",
|
34
|
+
"bin/newrelic_cmd",
|
35
|
+
"cert/cacert.pem",
|
36
|
+
"install.rb",
|
37
|
+
"lib/conditional_vendored_metric_parser.rb",
|
38
|
+
"lib/new_relic/agent.rb",
|
39
|
+
"lib/new_relic/agent/agent.rb",
|
40
|
+
"lib/new_relic/agent/browser_monitoring.rb",
|
41
|
+
"lib/new_relic/agent/busy_calculator.rb",
|
42
|
+
"lib/new_relic/agent/chained_call.rb",
|
43
|
+
"lib/new_relic/agent/error_collector.rb",
|
44
|
+
"lib/new_relic/agent/instrumentation/active_merchant.rb",
|
45
|
+
"lib/new_relic/agent/instrumentation/active_record_instrumentation.rb",
|
46
|
+
"lib/new_relic/agent/instrumentation/acts_as_solr.rb",
|
47
|
+
"lib/new_relic/agent/instrumentation/authlogic.rb",
|
48
|
+
"lib/new_relic/agent/instrumentation/controller_instrumentation.rb",
|
49
|
+
"lib/new_relic/agent/instrumentation/data_mapper.rb",
|
50
|
+
"lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb",
|
51
|
+
"lib/new_relic/agent/instrumentation/memcache.rb",
|
52
|
+
"lib/new_relic/agent/instrumentation/merb/controller.rb",
|
53
|
+
"lib/new_relic/agent/instrumentation/merb/errors.rb",
|
54
|
+
"lib/new_relic/agent/instrumentation/metric_frame.rb",
|
55
|
+
"lib/new_relic/agent/instrumentation/net.rb",
|
56
|
+
"lib/new_relic/agent/instrumentation/passenger_instrumentation.rb",
|
57
|
+
"lib/new_relic/agent/instrumentation/rack.rb",
|
58
|
+
"lib/new_relic/agent/instrumentation/rails/action_controller.rb",
|
59
|
+
"lib/new_relic/agent/instrumentation/rails/action_web_service.rb",
|
60
|
+
"lib/new_relic/agent/instrumentation/rails/errors.rb",
|
61
|
+
"lib/new_relic/agent/instrumentation/rails3/action_controller.rb",
|
62
|
+
"lib/new_relic/agent/instrumentation/rails3/errors.rb",
|
63
|
+
"lib/new_relic/agent/instrumentation/sinatra.rb",
|
64
|
+
"lib/new_relic/agent/instrumentation/sunspot.rb",
|
65
|
+
"lib/new_relic/agent/instrumentation/unicorn_instrumentation.rb",
|
66
|
+
"lib/new_relic/agent/method_tracer.rb",
|
67
|
+
"lib/new_relic/agent/sampler.rb",
|
68
|
+
"lib/new_relic/agent/samplers/cpu_sampler.rb",
|
69
|
+
"lib/new_relic/agent/samplers/delayed_job_lock_sampler.rb",
|
70
|
+
"lib/new_relic/agent/samplers/memory_sampler.rb",
|
71
|
+
"lib/new_relic/agent/samplers/object_sampler.rb",
|
72
|
+
"lib/new_relic/agent/shim_agent.rb",
|
73
|
+
"lib/new_relic/agent/stats_engine.rb",
|
74
|
+
"lib/new_relic/agent/stats_engine/metric_stats.rb",
|
75
|
+
"lib/new_relic/agent/stats_engine/samplers.rb",
|
76
|
+
"lib/new_relic/agent/stats_engine/transactions.rb",
|
77
|
+
"lib/new_relic/agent/transaction_sampler.rb",
|
78
|
+
"lib/new_relic/agent/worker_loop.rb",
|
79
|
+
"lib/new_relic/collection_helper.rb",
|
80
|
+
"lib/new_relic/command.rb",
|
81
|
+
"lib/new_relic/commands/deployments.rb",
|
82
|
+
"lib/new_relic/commands/install.rb",
|
83
|
+
"lib/new_relic/control.rb",
|
84
|
+
"lib/new_relic/control/configuration.rb",
|
85
|
+
"lib/new_relic/control/frameworks/external.rb",
|
86
|
+
"lib/new_relic/control/frameworks/merb.rb",
|
87
|
+
"lib/new_relic/control/frameworks/rails.rb",
|
88
|
+
"lib/new_relic/control/frameworks/rails3.rb",
|
89
|
+
"lib/new_relic/control/frameworks/ruby.rb",
|
90
|
+
"lib/new_relic/control/frameworks/sinatra.rb",
|
91
|
+
"lib/new_relic/control/instrumentation.rb",
|
92
|
+
"lib/new_relic/control/logging_methods.rb",
|
93
|
+
"lib/new_relic/control/profiling.rb",
|
94
|
+
"lib/new_relic/control/server_methods.rb",
|
95
|
+
"lib/new_relic/delayed_job_injection.rb",
|
96
|
+
"lib/new_relic/histogram.rb",
|
97
|
+
"lib/new_relic/local_environment.rb",
|
98
|
+
"lib/new_relic/merbtasks.rb",
|
99
|
+
"lib/new_relic/metric_data.rb",
|
100
|
+
"lib/new_relic/metric_spec.rb",
|
101
|
+
"lib/new_relic/metrics.rb",
|
102
|
+
"lib/new_relic/noticed_error.rb",
|
103
|
+
"lib/new_relic/rack/developer_mode.rb",
|
104
|
+
"lib/new_relic/rack/metric_app.rb",
|
105
|
+
"lib/new_relic/rack/mongrel_rpm.ru",
|
106
|
+
"lib/new_relic/rack/newrelic.yml",
|
107
|
+
"lib/new_relic/rack_app.rb",
|
108
|
+
"lib/new_relic/recipes.rb",
|
109
|
+
"lib/new_relic/stats.rb",
|
110
|
+
"lib/new_relic/timer_lib.rb",
|
111
|
+
"lib/new_relic/transaction_analysis.rb",
|
112
|
+
"lib/new_relic/transaction_sample.rb",
|
113
|
+
"lib/new_relic/url_rule.rb",
|
114
|
+
"lib/new_relic/version.rb",
|
115
|
+
"lib/newrelic_rpm.rb",
|
116
|
+
"lib/tasks/all.rb",
|
117
|
+
"lib/tasks/install.rake",
|
118
|
+
"lib/tasks/tests.rake",
|
119
|
+
"newrelic.yml",
|
120
|
+
"newrelic_rpm.gemspec",
|
121
|
+
"recipes/newrelic.rb",
|
122
|
+
"test/active_record_fixtures.rb",
|
123
|
+
"test/config/newrelic.yml",
|
124
|
+
"test/config/test_control.rb",
|
125
|
+
"test/new_relic/agent/active_record_instrumentation_test.rb",
|
126
|
+
"test/new_relic/agent/agent_controller_test.rb",
|
127
|
+
"test/new_relic/agent/agent_test_controller.rb",
|
128
|
+
"test/new_relic/agent/busy_calculator_test.rb",
|
129
|
+
"test/new_relic/agent/collection_helper_test.rb",
|
130
|
+
"test/new_relic/agent/error_collector_test.rb",
|
131
|
+
"test/new_relic/agent/memcache_instrumentation_test.rb",
|
132
|
+
"test/new_relic/agent/method_tracer_test.rb",
|
133
|
+
"test/new_relic/agent/metric_data_test.rb",
|
134
|
+
"test/new_relic/agent/metric_frame_test.rb",
|
135
|
+
"test/new_relic/agent/mock_scope_listener.rb",
|
136
|
+
"test/new_relic/agent/net_instrumentation_test.rb",
|
137
|
+
"test/new_relic/agent/rpm_agent_test.rb",
|
138
|
+
"test/new_relic/agent/stats_engine/metric_stats_test.rb",
|
139
|
+
"test/new_relic/agent/stats_engine/samplers_test.rb",
|
140
|
+
"test/new_relic/agent/stats_engine/stats_engine_test.rb",
|
141
|
+
"test/new_relic/agent/task_instrumentation_test.rb",
|
142
|
+
"test/new_relic/agent/testable_agent.rb",
|
143
|
+
"test/new_relic/agent/transaction_sample_builder_test.rb",
|
144
|
+
"test/new_relic/agent/transaction_sample_test.rb",
|
145
|
+
"test/new_relic/agent/transaction_sampler_test.rb",
|
146
|
+
"test/new_relic/agent/worker_loop_test.rb",
|
147
|
+
"test/new_relic/control_test.rb",
|
148
|
+
"test/new_relic/deployments_api_test.rb",
|
149
|
+
"test/new_relic/environment_test.rb",
|
150
|
+
"test/new_relic/metric_spec_test.rb",
|
151
|
+
"test/new_relic/rack/episodes_test.rb",
|
152
|
+
"test/new_relic/shim_agent_test.rb",
|
153
|
+
"test/new_relic/stats_test.rb",
|
154
|
+
"test/new_relic/version_number_test.rb",
|
155
|
+
"test/test_contexts.rb",
|
156
|
+
"test/test_helper.rb",
|
157
|
+
"ui/helpers/developer_mode_helper.rb",
|
158
|
+
"ui/helpers/google_pie_chart.rb",
|
159
|
+
"ui/views/layouts/newrelic_default.rhtml",
|
160
|
+
"ui/views/newrelic/_explain_plans.rhtml",
|
161
|
+
"ui/views/newrelic/_sample.rhtml",
|
162
|
+
"ui/views/newrelic/_segment.rhtml",
|
163
|
+
"ui/views/newrelic/_segment_limit_message.rhtml",
|
164
|
+
"ui/views/newrelic/_segment_row.rhtml",
|
165
|
+
"ui/views/newrelic/_show_sample_detail.rhtml",
|
166
|
+
"ui/views/newrelic/_show_sample_sql.rhtml",
|
167
|
+
"ui/views/newrelic/_show_sample_summary.rhtml",
|
168
|
+
"ui/views/newrelic/_sql_row.rhtml",
|
169
|
+
"ui/views/newrelic/_stack_trace.rhtml",
|
170
|
+
"ui/views/newrelic/_table.rhtml",
|
171
|
+
"ui/views/newrelic/explain_sql.rhtml",
|
172
|
+
"ui/views/newrelic/file/images/arrow-close.png",
|
173
|
+
"ui/views/newrelic/file/images/arrow-open.png",
|
174
|
+
"ui/views/newrelic/file/images/blue_bar.gif",
|
175
|
+
"ui/views/newrelic/file/images/file_icon.png",
|
176
|
+
"ui/views/newrelic/file/images/gray_bar.gif",
|
177
|
+
"ui/views/newrelic/file/images/new-relic-rpm-desktop.gif",
|
178
|
+
"ui/views/newrelic/file/images/new_relic_rpm_desktop.gif",
|
179
|
+
"ui/views/newrelic/file/images/textmate.png",
|
180
|
+
"ui/views/newrelic/file/javascript/jquery-1.4.2.js",
|
181
|
+
"ui/views/newrelic/file/javascript/transaction_sample.js",
|
182
|
+
"ui/views/newrelic/file/stylesheets/style.css",
|
183
|
+
"ui/views/newrelic/index.rhtml",
|
184
|
+
"ui/views/newrelic/sample_not_found.rhtml",
|
185
|
+
"ui/views/newrelic/show_sample.rhtml",
|
186
|
+
"ui/views/newrelic/show_source.rhtml",
|
187
|
+
"ui/views/newrelic/threads.rhtml",
|
188
|
+
"vendor/gems/metric_parser-0.1.0.pre1/LICENSE",
|
189
|
+
"vendor/gems/metric_parser-0.1.0.pre1/README",
|
190
|
+
"vendor/gems/metric_parser-0.1.0.pre1/lib/metric_parser.rb",
|
191
|
+
"vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser.rb",
|
192
|
+
"vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/action_mailer.rb",
|
193
|
+
"vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/active_merchant.rb",
|
194
|
+
"vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/active_record.rb",
|
195
|
+
"vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/apdex.rb",
|
196
|
+
"vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/background_transaction.rb",
|
197
|
+
"vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/client.rb",
|
198
|
+
"vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller.rb",
|
199
|
+
"vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller_cpu.rb",
|
200
|
+
"vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller_ext.rb",
|
201
|
+
"vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/database.rb",
|
202
|
+
"vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/database_pool.rb",
|
203
|
+
"vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/dot_net.rb",
|
204
|
+
"vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/dot_net_parser.rb",
|
205
|
+
"vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/errors.rb",
|
206
|
+
"vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/external.rb",
|
207
|
+
"vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/frontend.rb",
|
208
|
+
"vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/gc.rb",
|
209
|
+
"vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/hibernate_session.rb",
|
210
|
+
"vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/java.rb",
|
211
|
+
"vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/java_parser.rb",
|
212
|
+
"vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/jsp.rb",
|
213
|
+
"vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/jsp_tag.rb",
|
214
|
+
"vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/mem_cache.rb",
|
215
|
+
"vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/metric_parser.rb",
|
216
|
+
"vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/orm.rb",
|
217
|
+
"vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/other_transaction.rb",
|
218
|
+
"vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/servlet.rb",
|
219
|
+
"vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/servlet_context_listener.rb",
|
220
|
+
"vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/servlet_filter.rb",
|
221
|
+
"vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/solr.rb",
|
222
|
+
"vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/solr_request_handler.rb",
|
223
|
+
"vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/spring.rb",
|
224
|
+
"vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/spring_controller.rb",
|
225
|
+
"vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/spring_view.rb",
|
226
|
+
"vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/struts_action.rb",
|
227
|
+
"vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/struts_result.rb",
|
228
|
+
"vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/version.rb",
|
229
|
+
"vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/view.rb",
|
230
|
+
"vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/web_frontend.rb",
|
231
|
+
"vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/web_service.rb",
|
232
|
+
"vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/web_transaction.rb"
|
233
233
|
]
|
234
234
|
s.homepage = %q{http://www.github.com/newrelic/rpm}
|
235
235
|
s.post_install_message = %q{
|
@@ -258,7 +258,7 @@ Notice: Developer Mode now supports only Rails 2.3+ - refer to README
|
|
258
258
|
for instructions for previous versions
|
259
259
|
|
260
260
|
}
|
261
|
-
s.rdoc_options = ["--
|
261
|
+
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "New Relic Ruby Performance Monitoring Agent"]
|
262
262
|
s.require_paths = ["lib"]
|
263
263
|
s.rubygems_version = %q{1.3.7}
|
264
264
|
s.summary = %q{New Relic Ruby Performance Monitoring Agent}
|
@@ -61,9 +61,34 @@ class NewRelic::ControlTest < Test::Unit::TestCase
|
|
61
61
|
def test_resolve_ip
|
62
62
|
assert_equal nil, c.send(:convert_to_ip_address, 'localhost')
|
63
63
|
assert_equal nil, c.send(:convert_to_ip_address, 'q1239988737.us')
|
64
|
-
# This
|
65
|
-
assert_equal '
|
64
|
+
# This will fail if you don't have a valid, accessible, DNS server
|
65
|
+
assert_equal '204.93.223.153', c.send(:convert_to_ip_address, 'collector.newrelic.com')
|
66
66
|
end
|
67
|
+
|
68
|
+
class FakeResolv
|
69
|
+
def self.getaddress(host)
|
70
|
+
raise 'deliberately broken'
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def test_resolve_ip_with_broken_dns
|
75
|
+
# Here be dragons: disable the ruby DNS lookup methods we use so
|
76
|
+
# that it will actually fail to resolve.
|
77
|
+
old_resolv = Resolv
|
78
|
+
old_ipsocket = IPSocket
|
79
|
+
Object.instance_eval { remove_const :Resolv}
|
80
|
+
Object.instance_eval {remove_const:'IPSocket' }
|
81
|
+
assert_equal(nil, c.send(:convert_to_ip_address, 'collector.newrelic.com'), "DNS is down, should be no IP for server")
|
82
|
+
|
83
|
+
Object.instance_eval {const_set('Resolv', old_resolv); const_set('IPSocket', old_ipsocket)}
|
84
|
+
# these are here to make sure that the constant tomfoolery above
|
85
|
+
# has not broket the system unduly
|
86
|
+
assert_equal old_resolv, Resolv
|
87
|
+
assert_equal old_ipsocket, IPSocket
|
88
|
+
end
|
89
|
+
|
90
|
+
|
91
|
+
|
67
92
|
def test_config_yaml_erb
|
68
93
|
assert_equal 'heyheyhey', c['erb_value']
|
69
94
|
assert_equal '', c['message']
|
metadata
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: newrelic_rpm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: -1847304032
|
5
|
+
prerelease: true
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 13
|
9
|
-
-
|
10
|
-
|
9
|
+
- 4
|
10
|
+
- eum1
|
11
|
+
version: 2.13.4.eum1
|
11
12
|
platform: ruby
|
12
13
|
authors:
|
13
14
|
- Bill Kayser
|
@@ -16,7 +17,7 @@ autorequire:
|
|
16
17
|
bindir: bin
|
17
18
|
cert_chain: []
|
18
19
|
|
19
|
-
date:
|
20
|
+
date: 2011-02-11 00:00:00 -08:00
|
20
21
|
default_executable:
|
21
22
|
dependencies:
|
22
23
|
- !ruby/object:Gem::Dependency
|
@@ -71,9 +72,9 @@ description: |
|
|
71
72
|
|
72
73
|
email: support@newrelic.com
|
73
74
|
executables:
|
74
|
-
- mongrel_rpm
|
75
|
-
- newrelic
|
76
75
|
- newrelic_cmd
|
76
|
+
- newrelic
|
77
|
+
- mongrel_rpm
|
77
78
|
extensions: []
|
78
79
|
|
79
80
|
extra_rdoc_files:
|
@@ -93,6 +94,7 @@ files:
|
|
93
94
|
- lib/conditional_vendored_metric_parser.rb
|
94
95
|
- lib/new_relic/agent.rb
|
95
96
|
- lib/new_relic/agent/agent.rb
|
97
|
+
- lib/new_relic/agent/browser_monitoring.rb
|
96
98
|
- lib/new_relic/agent/busy_calculator.rb
|
97
99
|
- lib/new_relic/agent/chained_call.rb
|
98
100
|
- lib/new_relic/agent/error_collector.rb
|
@@ -167,7 +169,6 @@ files:
|
|
167
169
|
- lib/new_relic/transaction_sample.rb
|
168
170
|
- lib/new_relic/url_rule.rb
|
169
171
|
- lib/new_relic/version.rb
|
170
|
-
- lib/new_relic_api.rb
|
171
172
|
- lib/newrelic_rpm.rb
|
172
173
|
- lib/tasks/all.rb
|
173
174
|
- lib/tasks/install.rake
|
@@ -317,7 +318,6 @@ post_install_message: |+
|
|
317
318
|
for instructions for previous versions
|
318
319
|
|
319
320
|
rdoc_options:
|
320
|
-
- --charset=UTF-8
|
321
321
|
- --line-numbers
|
322
322
|
- --inline-source
|
323
323
|
- --title
|
@@ -336,14 +336,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
336
336
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
337
337
|
none: false
|
338
338
|
requirements:
|
339
|
-
- - "
|
339
|
+
- - ">="
|
340
340
|
- !ruby/object:Gem::Version
|
341
|
-
hash:
|
341
|
+
hash: 3
|
342
342
|
segments:
|
343
|
-
-
|
344
|
-
|
345
|
-
- 1
|
346
|
-
version: 1.3.1
|
343
|
+
- 0
|
344
|
+
version: "0"
|
347
345
|
requirements: []
|
348
346
|
|
349
347
|
rubyforge_project:
|
data/lib/new_relic_api.rb
DELETED
@@ -1,276 +0,0 @@
|
|
1
|
-
# == REST API Helpers
|
2
|
-
#
|
3
|
-
# Ruby lib for working with the New Relic API's XML interface. Requires Rails 2.0 or later to be loaded.
|
4
|
-
#
|
5
|
-
# Can also be used as a script using script/runner
|
6
|
-
#
|
7
|
-
# Authentication is handled using your agent license key or HTTP Basic Authentication. To authenticate
|
8
|
-
# using your license key your newrelic.yml configuration file must be in your application config directory
|
9
|
-
# and contain your license key. The New Relic account associated with the license key must allow api access.
|
10
|
-
# Log into RPM, click Account at the top of the page and check the "Make my account data accessible" checkbox.
|
11
|
-
#
|
12
|
-
# Basic authentication uses your site credentials to authenticate.
|
13
|
-
#
|
14
|
-
# # To authenticate using basic authentication, make this call with your username and password:
|
15
|
-
# NewRelicApi.authenticate('user@example.com', 'test')
|
16
|
-
#
|
17
|
-
# This API does not have any agent dependencies. It can be used independent of the agent by copying it into your application.
|
18
|
-
#
|
19
|
-
# == Examples
|
20
|
-
#
|
21
|
-
# # Fetching the list of applications for an account
|
22
|
-
# NewRelicApi::Account.find(:first).applications
|
23
|
-
#
|
24
|
-
# # Fetching the health values for all account applications
|
25
|
-
# NewRelicApi::Account.application_health
|
26
|
-
#
|
27
|
-
# # Fetching the health values for an application
|
28
|
-
# NewRelicApi::Account.find(:first).applications.first.threshold_values
|
29
|
-
#
|
30
|
-
# # Finding an application by name
|
31
|
-
# NewRelicApi::Account.find(:first).applications(:params => {:conditions => {:name => 'My App'}})
|
32
|
-
#
|
33
|
-
|
34
|
-
module NewRelicApi
|
35
|
-
|
36
|
-
# This mixin defines ActiveRecord style associations (like has_many) for ActiveResource objects.
|
37
|
-
# ActiveResource objects using this mixin must define the method 'query_params'.
|
38
|
-
module ActiveResourceAssociations #:nodoc:
|
39
|
-
class << self
|
40
|
-
protected
|
41
|
-
def included(base)
|
42
|
-
class << base
|
43
|
-
# a special activeresource implementation of has_many
|
44
|
-
def has_many(*associations)
|
45
|
-
associations.to_a.each do |association|
|
46
|
-
define_method association do |*args|
|
47
|
-
val = attributes[association.to_s] # if we've already fetched the relationship in the initial fetch, return it
|
48
|
-
return val if val
|
49
|
-
|
50
|
-
options = args.extract_options!
|
51
|
-
type = args.first || :all
|
52
|
-
|
53
|
-
begin
|
54
|
-
# look for the class definition within the current class
|
55
|
-
clazz = ( self.class.name + '::' + association.to_s.camelize.singularize).constantize
|
56
|
-
rescue
|
57
|
-
# look for the class definition in the NRAPI module
|
58
|
-
clazz = ( 'NewRelicApi::' + association.to_s.camelize.singularize).constantize
|
59
|
-
end
|
60
|
-
params = (options[:params] || {}).update(self.query_params)
|
61
|
-
options[:params] = params
|
62
|
-
clazz.find(type, options)
|
63
|
-
|
64
|
-
#clazz.find(type, :params => options.update(self.query_params))
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
end
|
73
|
-
class << self
|
74
|
-
attr_accessor :email, :password, :license_key, :ssl, :host, :port
|
75
|
-
|
76
|
-
# Sets up basic authentication credentials for all the resources. This is not necessary if you are
|
77
|
-
# using agent license key authentication.
|
78
|
-
def authenticate(email, password)
|
79
|
-
@password = password
|
80
|
-
@email = email
|
81
|
-
end
|
82
|
-
|
83
|
-
# Resets the base path of all resources. This should be called when overridding the newrelic.yml settings
|
84
|
-
# using the ssl, host or port accessors.
|
85
|
-
def reset!
|
86
|
-
@classes.each {|klass| klass.reset!} if @classes
|
87
|
-
NewRelicApi::Account.site_url
|
88
|
-
end
|
89
|
-
|
90
|
-
|
91
|
-
def track_resource(klass) #:nodoc:
|
92
|
-
(@classes ||= []) << klass
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
class BaseResource < ActiveResource::Base #:nodoc:
|
97
|
-
include ActiveResourceAssociations
|
98
|
-
|
99
|
-
class << self
|
100
|
-
def inherited(klass) #:nodoc:
|
101
|
-
NewRelicApi.track_resource(klass)
|
102
|
-
end
|
103
|
-
|
104
|
-
def headers
|
105
|
-
h = {'x-license-key' => NewRelicApi.license_key || NewRelic::Control.instance['license_key']}
|
106
|
-
h['Authorization'] = 'Basic ' + ["#{NewRelicApi.email}:#{NewRelicApi.password}"].pack('m').delete("\r\n") if NewRelicApi.email
|
107
|
-
h
|
108
|
-
end
|
109
|
-
|
110
|
-
def site_url
|
111
|
-
host = NewRelicApi.host || NewRelic::Control.instance.api_server.name
|
112
|
-
port = NewRelicApi.port || NewRelic::Control.instance.api_server.port
|
113
|
-
"#{port == 443 ? 'https' : 'http'}://#{host}:#{port}"
|
114
|
-
end
|
115
|
-
|
116
|
-
def reset!
|
117
|
-
self.site = self.site_url
|
118
|
-
end
|
119
|
-
|
120
|
-
protected
|
121
|
-
|
122
|
-
def fix_fields(*fields)
|
123
|
-
fields.to_a.each do |field|
|
124
|
-
define_method field do
|
125
|
-
yield super
|
126
|
-
end
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
def fix_integer_fields(*fields)
|
131
|
-
fix_fields(*fields) { |sup| sup.to_i }
|
132
|
-
end
|
133
|
-
|
134
|
-
def fix_float_fields(*fields)
|
135
|
-
fix_fields(*fields) { |sup| sup.to_f }
|
136
|
-
end
|
137
|
-
|
138
|
-
end
|
139
|
-
self.site = self.site_url
|
140
|
-
end
|
141
|
-
ACCOUNT_RESOURCE_PATH = '/accounts/:account_id/' #:nodoc:
|
142
|
-
ACCOUNT_AGENT_RESOURCE_PATH = ACCOUNT_RESOURCE_PATH + 'agents/:agent_id/' #:nodoc:
|
143
|
-
ACCOUNT_APPLICATION_RESOURCE_PATH = ACCOUNT_RESOURCE_PATH + 'applications/:application_id/' #:nodoc:
|
144
|
-
|
145
|
-
module AccountResource #:nodoc:
|
146
|
-
def account_id
|
147
|
-
prefix_options[:account_id]
|
148
|
-
end
|
149
|
-
def account_query_params(extra_params = {})
|
150
|
-
{:account_id => account_id}.merge(extra_params)
|
151
|
-
end
|
152
|
-
|
153
|
-
def query_params#:nodoc:
|
154
|
-
account_query_params
|
155
|
-
end
|
156
|
-
end
|
157
|
-
|
158
|
-
module AgentResource #:nodoc:
|
159
|
-
include ActiveResourceAssociations
|
160
|
-
end
|
161
|
-
|
162
|
-
# An application has many:
|
163
|
-
# +agents+:: the agent instances associated with this app
|
164
|
-
# +threshold_values+:: the health indicators for this application.
|
165
|
-
class Application < BaseResource
|
166
|
-
include AccountResource
|
167
|
-
include AgentResource
|
168
|
-
|
169
|
-
has_many :agents, :threshold_values
|
170
|
-
|
171
|
-
self.prefix = ACCOUNT_RESOURCE_PATH
|
172
|
-
|
173
|
-
def query_params#:nodoc:
|
174
|
-
account_query_params(:application_id => id)
|
175
|
-
end
|
176
|
-
|
177
|
-
class Agent < BaseResource
|
178
|
-
include AccountResource
|
179
|
-
include AgentResource
|
180
|
-
|
181
|
-
self.prefix = ACCOUNT_APPLICATION_RESOURCE_PATH
|
182
|
-
|
183
|
-
def query_params#:nodoc:
|
184
|
-
super.merge(:application_id => cluster_agent_id)
|
185
|
-
end
|
186
|
-
end
|
187
|
-
|
188
|
-
end
|
189
|
-
|
190
|
-
# A threshold value represents a single health indicator for an application such as CPU, memory or response time.
|
191
|
-
#
|
192
|
-
# ==Fields
|
193
|
-
# +name+:: The name of the threshold setting associated with this threshold value.
|
194
|
-
# +threshold_value+:: A value of 0, 1, 2 or 3 representing gray (not reporting), green, yellow and red
|
195
|
-
# +metric_value+:: The metric value associated with this threshold
|
196
|
-
class ThresholdValue < BaseResource
|
197
|
-
self.prefix = ACCOUNT_APPLICATION_RESOURCE_PATH
|
198
|
-
# attr_reader :name, :begin_time, :metric_value, :threshold_value
|
199
|
-
|
200
|
-
fix_integer_fields :threshold_value
|
201
|
-
fix_float_fields :metric_value
|
202
|
-
|
203
|
-
# Returns the color value for this threshold (Gray, Green, Yellow or Red).
|
204
|
-
def color_value
|
205
|
-
case threshold_value
|
206
|
-
when 3: 'Red'
|
207
|
-
when 2: 'Yellow'
|
208
|
-
when 1: 'Green'
|
209
|
-
else 'Gray'
|
210
|
-
end
|
211
|
-
end
|
212
|
-
|
213
|
-
def to_s #:nodoc:
|
214
|
-
"#{name}: #{color_value} (#{formatted_metric_value})"
|
215
|
-
end
|
216
|
-
end
|
217
|
-
|
218
|
-
# An account contains your basic account information.
|
219
|
-
#
|
220
|
-
# Accounts have many
|
221
|
-
# +applications+:: the applications contained within the account
|
222
|
-
#
|
223
|
-
# Find Accounts
|
224
|
-
#
|
225
|
-
# NewRelicApi::Account.find(:all) # find all accounts for the current user.
|
226
|
-
# NewRelicApi::Account.find(44) # find individual account by ID
|
227
|
-
#
|
228
|
-
class Account < BaseResource
|
229
|
-
has_many :applications
|
230
|
-
has_many :account_views
|
231
|
-
|
232
|
-
def query_params #:nodoc:
|
233
|
-
{:account_id => id}
|
234
|
-
end
|
235
|
-
|
236
|
-
# Returns an account including all of its applications and the threshold values for each application.
|
237
|
-
def self.application_health(type = :first)
|
238
|
-
find(type, :params => {:include => :application_health})
|
239
|
-
end
|
240
|
-
|
241
|
-
class AccountView < BaseResource
|
242
|
-
self.prefix = ACCOUNT_RESOURCE_PATH
|
243
|
-
|
244
|
-
def query_params(extra_params = {}) #:nodoc:
|
245
|
-
{:account_id => account_id}.merge(extra_params)
|
246
|
-
end
|
247
|
-
|
248
|
-
def user
|
249
|
-
@attributes['user']
|
250
|
-
end
|
251
|
-
end
|
252
|
-
|
253
|
-
class AccountUsage < BaseResource
|
254
|
-
end
|
255
|
-
end
|
256
|
-
|
257
|
-
# This model is used to mark production deployments in RPM
|
258
|
-
# Only create is supported.
|
259
|
-
# ==Examples
|
260
|
-
# # Creating a new deployment
|
261
|
-
# NewRelicApi::Deployment.create
|
262
|
-
#
|
263
|
-
class Deployment < BaseResource
|
264
|
-
end
|
265
|
-
|
266
|
-
class Subscription < BaseResource
|
267
|
-
def query_params(extra_params = {}) #:nodoc:
|
268
|
-
{:account_id => account_id}.merge(extra_params)
|
269
|
-
end
|
270
|
-
end
|
271
|
-
|
272
|
-
class User < BaseResource
|
273
|
-
end
|
274
|
-
|
275
|
-
end
|
276
|
-
|