newrelic_rpm 3.2.0.beta1 → 3.2.0.beta2
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 -3
- data/lib/new_relic/agent/agent.rb +8 -7
- data/lib/new_relic/agent/sql_sampler.rb +51 -13
- data/lib/new_relic/agent/stats_engine/metric_stats.rb +8 -6
- data/lib/new_relic/agent/transaction_sampler.rb +10 -0
- data/lib/new_relic/control/frameworks/rails.rb +2 -2
- data/lib/new_relic/delayed_job_injection.rb +2 -0
- data/lib/new_relic/language_support.rb +17 -14
- data/lib/new_relic/local_environment.rb +0 -1
- data/lib/new_relic/transaction_sample/segment.rb +1 -1
- data/lib/new_relic/version.rb +1 -1
- data/newrelic_rpm.gemspec +6 -6
- data/test/new_relic/agent/agent/connect_test.rb +18 -16
- data/test/new_relic/agent/agent/start_test.rb +7 -7
- data/test/new_relic/agent/browser_monitoring_test.rb +2 -2
- data/test/new_relic/agent/database_test.rb +2 -0
- data/test/new_relic/agent/sql_sampler_test.rb +26 -1
- data/test/new_relic/agent/stats_engine/metric_stats_test.rb +19 -18
- data/test/new_relic/agent/transaction_sampler_test.rb +1 -0
- data/test/new_relic/control/configuration_test.rb +2 -1
- data/test/new_relic/control_test.rb +87 -54
- data/test/new_relic/data_serialization_test.rb +6 -5
- metadata +9 -11
data/CHANGELOG
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
v3.2.0
|
2
2
|
* Fix over-detection of mongrel and unicorn and only start the agent when
|
3
3
|
actual server is running
|
4
|
-
* Improve developer mode backtraces to support ruby 1.9.2, windows
|
5
|
-
nil de-reference in developer mode
|
4
|
+
* Improve developer mode backtraces to support ruby 1.9.2, windows
|
6
5
|
* Fixed some cases where Memcache instrumentation was failing to load
|
7
|
-
* Added View instrumentation back for Rails 3.1
|
8
6
|
* Ability to set log destination by NEW_RELIC_LOG env var
|
7
|
+
* Fix to mutex lib load issue
|
8
|
+
* Performance enhancements (thanks to Jeremy Kemper)
|
9
|
+
* Fix overly verbose STDOUT message (thanks to Anselm Helbig)
|
9
10
|
|
10
11
|
v3.1.2
|
11
12
|
* Fixed some thread safety issues
|
@@ -329,8 +329,8 @@ module NewRelic
|
|
329
329
|
# we should not set an at_exit block if people are using
|
330
330
|
# these as they don't do standard at_exit behavior per MRI/YARV
|
331
331
|
def weird_ruby?
|
332
|
-
NewRelic::LanguageSupport.
|
333
|
-
NewRelic::LanguageSupport.
|
332
|
+
NewRelic::LanguageSupport.using_engine?('rbx') ||
|
333
|
+
NewRelic::LanguageSupport.using_engine?('jruby') ||
|
334
334
|
using_sinatra?
|
335
335
|
end
|
336
336
|
|
@@ -469,7 +469,7 @@ module NewRelic
|
|
469
469
|
def check_sql_sampler_status
|
470
470
|
# disable sql sampling if disabled by the server
|
471
471
|
# and we're not in dev mode
|
472
|
-
if
|
472
|
+
if @sql_sampler.config.fetch('enabled', true) && ['raw', 'obfuscated'].include?(@sql_sampler.config.fetch('record_sql', 'obfuscated').to_s)
|
473
473
|
@sql_sampler.enable
|
474
474
|
else
|
475
475
|
@sql_sampler.disable
|
@@ -757,10 +757,9 @@ module NewRelic
|
|
757
757
|
def config_transaction_tracer
|
758
758
|
# Reconfigure the transaction tracer
|
759
759
|
@transaction_sampler.configure!
|
760
|
+
@sql_sampler.configure!
|
760
761
|
@should_send_samples = @config_should_send_samples = sampler_config.fetch('enabled', true)
|
761
762
|
@should_send_random_samples = sampler_config.fetch('random_sample', false)
|
762
|
-
@explain_threshold = sampler_config.fetch('explain_threshold', 0.5).to_f
|
763
|
-
@explain_enabled = sampler_config.fetch('explain_enabled', true)
|
764
763
|
set_sql_recording!
|
765
764
|
|
766
765
|
# default to 2.0, string 'apdex_f' will turn into your
|
@@ -829,7 +828,7 @@ module NewRelic
|
|
829
828
|
|
830
829
|
# gets the sampler configuration from the control object's settings
|
831
830
|
def sampler_config
|
832
|
-
|
831
|
+
NewRelic::Control.instance.fetch('transaction_tracer', {})
|
833
832
|
end
|
834
833
|
|
835
834
|
# Asks the collector to tell us which sub-collector we
|
@@ -1069,7 +1068,9 @@ module NewRelic
|
|
1069
1068
|
begin
|
1070
1069
|
options = { :keep_backtraces => true }
|
1071
1070
|
options[:record_sql] = @record_sql unless @record_sql == :off
|
1072
|
-
|
1071
|
+
if @transaction_sampler.explain_enabled
|
1072
|
+
options[:explain_sql] = @transaction_sampler.explain_threshold
|
1073
|
+
end
|
1073
1074
|
traces = @traces.collect {|trace| trace.prepare_to_send(options)}
|
1074
1075
|
invoke_remote :transaction_sample_data, @agent_id, traces
|
1075
1076
|
rescue PostTooBigException
|
@@ -18,10 +18,7 @@ module NewRelic
|
|
18
18
|
attr_reader :sql_traces
|
19
19
|
|
20
20
|
def initialize
|
21
|
-
|
22
|
-
sampler_config = config.fetch('transaction_tracer', {})
|
23
|
-
@explain_threshold = sampler_config.fetch('explain_threshold', 0.5).to_f
|
24
|
-
# @stack_trace_threshold = sampler_config.fetch('stack_trace_threshold', 0.500).to_f
|
21
|
+
configure!
|
25
22
|
@sql_traces = {}
|
26
23
|
clear_transaction_data
|
27
24
|
|
@@ -30,7 +27,21 @@ module NewRelic
|
|
30
27
|
# any 'honest-to-god'-multithreaded system
|
31
28
|
@samples_lock = Mutex.new
|
32
29
|
end
|
30
|
+
|
31
|
+
def configure!
|
32
|
+
@explain_threshold = config.fetch('explain_threshold', 0.5).to_f
|
33
|
+
@explain_enabled = config.fetch('explain_enabled', true)
|
34
|
+
@stack_trace_threshold = config.fetch('stack_trace_threshold',
|
35
|
+
0.5).to_f
|
36
|
+
# config.fetch('enabled', true) ? self.enable : self.disable
|
37
|
+
end
|
33
38
|
|
39
|
+
def config
|
40
|
+
control = NewRelic::Control.instance
|
41
|
+
control.fetch('slow_sql',
|
42
|
+
control.fetch('transaction_tracer', {}))
|
43
|
+
end
|
44
|
+
|
34
45
|
# Enable the sql sampler - this also registers it with
|
35
46
|
# the statistics engine.
|
36
47
|
def enable
|
@@ -45,6 +56,10 @@ module NewRelic
|
|
45
56
|
NewRelic::Agent.instance.stats_engine.remove_sql_sampler(self)
|
46
57
|
end
|
47
58
|
|
59
|
+
def enabled?
|
60
|
+
!@disabled
|
61
|
+
end
|
62
|
+
|
48
63
|
def notice_transaction(path, uri=nil, params={})
|
49
64
|
transaction_data.set_transaction_info(path, uri, params) if !disabled && transaction_data
|
50
65
|
end
|
@@ -82,13 +97,13 @@ module NewRelic
|
|
82
97
|
# this should always be called under the @samples_lock
|
83
98
|
def harvest_slow_sql(transaction_sql_data)
|
84
99
|
transaction_sql_data.sql_data.each do |sql_item|
|
85
|
-
|
86
|
-
sql_trace = @sql_traces[
|
100
|
+
normalized_sql = sql_item.normalize
|
101
|
+
sql_trace = @sql_traces[normalized_sql]
|
87
102
|
if sql_trace
|
88
103
|
sql_trace.aggregate(sql_item, transaction_sql_data.path,
|
89
104
|
transaction_sql_data.uri)
|
90
105
|
else
|
91
|
-
@sql_traces[
|
106
|
+
@sql_traces[normalized_sql] = SqlTrace.new(normalized_sql,
|
92
107
|
sql_item, transaction_sql_data.path, transaction_sql_data.uri)
|
93
108
|
end
|
94
109
|
end
|
@@ -167,7 +182,7 @@ module NewRelic
|
|
167
182
|
|
168
183
|
def normalize
|
169
184
|
NewRelic::Agent::Database::Obfuscator.instance \
|
170
|
-
.default_sql_obfuscator(@sql).gsub(/\?\s*\,\s*/, '')
|
185
|
+
.default_sql_obfuscator(@sql).gsub(/\?\s*\,\s*/, '').gsub(/\s/, '')
|
171
186
|
end
|
172
187
|
|
173
188
|
def explain
|
@@ -183,10 +198,10 @@ module NewRelic
|
|
183
198
|
attr_reader :database_metric_name
|
184
199
|
attr_reader :params
|
185
200
|
|
186
|
-
def initialize(
|
201
|
+
def initialize(normalized_query, slow_sql, path, uri)
|
187
202
|
super()
|
188
203
|
@params = {} #FIXME
|
189
|
-
@sql_id =
|
204
|
+
@sql_id = consistent_hash(normalized_query)
|
190
205
|
set_primary slow_sql, path, uri
|
191
206
|
record_data_point slow_sql.duration
|
192
207
|
end
|
@@ -211,20 +226,43 @@ module NewRelic
|
|
211
226
|
|
212
227
|
def prepare_to_send
|
213
228
|
begin
|
214
|
-
params[:explain_plan] = @slow_sql.explain
|
229
|
+
params[:explain_plan] = @slow_sql.explain if need_to_explain?
|
215
230
|
ensure
|
216
231
|
NewRelic::Agent::Database.close_connections
|
217
232
|
end
|
218
233
|
@sql = @slow_sql.obfuscate if need_to_obfuscate?
|
219
234
|
end
|
220
|
-
|
235
|
+
|
236
|
+
def agent_config
|
237
|
+
control = NewRelic::Control.instance
|
238
|
+
control.fetch('slow_sql',
|
239
|
+
control.fetch('transaction_tracer', {}))
|
240
|
+
end
|
241
|
+
|
221
242
|
def need_to_obfuscate?
|
222
|
-
|
243
|
+
agent_config['record_sql'] == 'obfuscated'
|
244
|
+
end
|
245
|
+
|
246
|
+
def need_to_explain?
|
247
|
+
agent_config['explain_enabled']
|
223
248
|
end
|
224
249
|
|
225
250
|
def to_json(*a)
|
226
251
|
[@path, @url, @sql_id, @sql, @database_metric_name, @call_count, @total_call_time, @min_call_time, @max_call_time, @params].to_json(*a)
|
227
252
|
end
|
253
|
+
|
254
|
+
private
|
255
|
+
|
256
|
+
def consistent_hash(string)
|
257
|
+
if NewRelic::LanguageSupport.using_version?('1.9.2')
|
258
|
+
# String#hash is salted differently on every VM start in 1.9
|
259
|
+
# modulo ensures sql_id fits in an INT(11)
|
260
|
+
require 'digest/md5'
|
261
|
+
Digest::MD5.hexdigest(string).hex.modulo(2**31-1)
|
262
|
+
else
|
263
|
+
string.hash
|
264
|
+
end
|
265
|
+
end
|
228
266
|
end
|
229
267
|
end
|
230
268
|
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'sync'
|
2
1
|
require 'new_relic/language_support'
|
3
2
|
|
4
3
|
module NewRelic
|
@@ -10,22 +9,25 @@ module NewRelic
|
|
10
9
|
# are internally consistent even in truly-threaded rubies like JRuby
|
11
10
|
class SynchronizedHash < ::Hash
|
12
11
|
include NewRelic::LanguageSupport::SynchronizedHash
|
13
|
-
|
12
|
+
|
13
|
+
def initialize
|
14
|
+
@lock = Mutex.new
|
15
|
+
end
|
14
16
|
|
15
17
|
def []=(*args)
|
16
|
-
|
18
|
+
@lock.synchronize { super }
|
17
19
|
end
|
18
20
|
|
19
21
|
def clear(*args)
|
20
|
-
|
22
|
+
@lock.synchronize { super }
|
21
23
|
end
|
22
24
|
|
23
25
|
def delete(*args)
|
24
|
-
|
26
|
+
@lock.synchronize { super }
|
25
27
|
end
|
26
28
|
|
27
29
|
def delete_if(*args)
|
28
|
-
|
30
|
+
@lock.synchronize { super }
|
29
31
|
end
|
30
32
|
end
|
31
33
|
|
@@ -19,6 +19,7 @@ module NewRelic
|
|
19
19
|
BUILDER_KEY = :transaction_sample_builder
|
20
20
|
|
21
21
|
attr_accessor :stack_trace_threshold, :random_sampling, :sampling_rate
|
22
|
+
attr_accessor :explain_threshold, :explain_enabled, :transaction_threshold
|
22
23
|
attr_reader :samples, :last_sample, :disabled
|
23
24
|
|
24
25
|
def initialize
|
@@ -46,9 +47,14 @@ module NewRelic
|
|
46
47
|
# suffice for most customers
|
47
48
|
config = NewRelic::Control.instance
|
48
49
|
sampler_config = config.fetch('transaction_tracer', {})
|
50
|
+
|
51
|
+
# enable if sampler_config.fetch('enabled', true)
|
52
|
+
|
49
53
|
@segment_limit = sampler_config.fetch('limit_segments', 4000)
|
50
54
|
@stack_trace_threshold = sampler_config.fetch('stack_trace_threshold', 0.500).to_f
|
51
55
|
@explain_threshold = sampler_config.fetch('explain_threshold', 0.5).to_f
|
56
|
+
@explain_enabled = sampler_config.fetch('explain_enabled', true)
|
57
|
+
@transaction_threshold = sampler_config.fetch('transation_threshold', 2.0)
|
52
58
|
end
|
53
59
|
|
54
60
|
# Returns the current sample id, delegated from `builder`
|
@@ -71,6 +77,10 @@ module NewRelic
|
|
71
77
|
NewRelic::Agent.instance.stats_engine.remove_transaction_sampler(self)
|
72
78
|
end
|
73
79
|
|
80
|
+
def enabled?
|
81
|
+
!@disabled
|
82
|
+
end
|
83
|
+
|
74
84
|
# Set with an integer value n, this takes one in every n
|
75
85
|
# harvested samples. It also resets the harvest count to a
|
76
86
|
# random integer between 0 and (n-1)
|
@@ -87,7 +87,7 @@ module NewRelic
|
|
87
87
|
|
88
88
|
def log!(msg, level=:info)
|
89
89
|
if should_log?
|
90
|
-
logger = ::Rails.respond_to?(:logger) ? Rails.logger : ::RAILS_DEFAULT_LOGGER
|
90
|
+
logger = ::Rails.respond_to?(:logger) ? ::Rails.logger : ::RAILS_DEFAULT_LOGGER
|
91
91
|
logger.send(level, msg)
|
92
92
|
else
|
93
93
|
super
|
@@ -97,7 +97,7 @@ module NewRelic
|
|
97
97
|
end
|
98
98
|
|
99
99
|
def to_stdout(message)
|
100
|
-
logger = ::Rails.respond_to?(:logger) ? Rails.logger : ::RAILS_DEFAULT_LOGGER
|
100
|
+
logger = ::Rails.respond_to?(:logger) ? ::Rails.logger : ::RAILS_DEFAULT_LOGGER
|
101
101
|
logger.info(message)
|
102
102
|
rescue Exception => e
|
103
103
|
super
|
@@ -4,9 +4,9 @@ module NewRelic::LanguageSupport
|
|
4
4
|
module DataSerialization
|
5
5
|
def self.included(base)
|
6
6
|
# need to disable GC during marshal load in 1.8.7
|
7
|
-
if ::
|
8
|
-
!NewRelic::LanguageSupport.
|
9
|
-
!NewRelic::LanguageSupport.
|
7
|
+
if NewRelic::LanguageSupport.using_version?('1.8.7') &&
|
8
|
+
!NewRelic::LanguageSupport.using_engine?('jruby') &&
|
9
|
+
!NewRelic::LanguageSupport.using_engine?('rbx')
|
10
10
|
base.class_eval do
|
11
11
|
def self.load(*args)
|
12
12
|
if defined?(::GC) && ::GC.respond_to?(:disable)
|
@@ -43,24 +43,27 @@ module NewRelic::LanguageSupport
|
|
43
43
|
module SynchronizedHash
|
44
44
|
def self.included(base)
|
45
45
|
# need to lock iteration of stats hash in 1.9.x
|
46
|
-
if ::
|
47
|
-
NewRelic::LanguageSupport.
|
46
|
+
if NewRelic::LanguageSupport.using_version?('1.9') ||
|
47
|
+
NewRelic::LanguageSupport.using_engine?('jruby')
|
48
48
|
base.class_eval do
|
49
49
|
def each(*args, &block)
|
50
|
-
|
50
|
+
@lock.synchronize { super }
|
51
51
|
end
|
52
52
|
end
|
53
53
|
end
|
54
54
|
end
|
55
55
|
end
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
56
|
+
|
57
|
+
def using_engine?(engine)
|
58
|
+
if defined?(::RUBY_ENGINE)
|
59
|
+
::RUBY_ENGINE == engine
|
60
|
+
else
|
61
|
+
engine == 'ruby'
|
62
|
+
end
|
60
63
|
end
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
64
|
+
|
65
|
+
def using_version?(version)
|
66
|
+
numbers = version.split('.')
|
67
|
+
numbers == ::RUBY_VERSION.split('.')[0, numbers.size]
|
65
68
|
end
|
66
69
|
end
|
@@ -333,7 +333,6 @@ module NewRelic
|
|
333
333
|
if (defined?(::Unicorn) && defined?(::Unicorn::HttpServer)) && working_jruby?
|
334
334
|
v = find_class_in_object_space(::Unicorn::HttpServer)
|
335
335
|
@dispatcher = :unicorn if v
|
336
|
-
puts "We DETECTED UNICORN???: #{v.inspect}"
|
337
336
|
end
|
338
337
|
end
|
339
338
|
|
data/lib/new_relic/version.rb
CHANGED
@@ -4,7 +4,7 @@ module NewRelic
|
|
4
4
|
MAJOR = 3
|
5
5
|
MINOR = 2
|
6
6
|
TINY = 0
|
7
|
-
BUILD = '
|
7
|
+
BUILD = 'beta2' #'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
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{newrelic_rpm}
|
8
|
-
s.version = "3.2.0.
|
8
|
+
s.version = "3.2.0.beta2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = [
|
12
|
-
s.date = %q{2011-
|
11
|
+
s.authors = [%q{Bill Kayser}, %q{Jon Guymon}, %q{Justin George}, %q{Darin Swanson}]
|
12
|
+
s.date = %q{2011-10-13}
|
13
13
|
s.description = %q{New Relic is a performance management system, developed by New Relic,
|
14
14
|
Inc (http://www.newrelic.com). New Relic provides you with deep
|
15
15
|
information about the performance of your web application as it runs
|
@@ -18,7 +18,7 @@ Gem or plugin, hosted on
|
|
18
18
|
http://github.com/newrelic/rpm/
|
19
19
|
}
|
20
20
|
s.email = %q{support@newrelic.com}
|
21
|
-
s.executables = [
|
21
|
+
s.executables = [%q{mongrel_rpm}, %q{newrelic}, %q{newrelic_cmd}]
|
22
22
|
s.extra_rdoc_files = [
|
23
23
|
"CHANGELOG",
|
24
24
|
"LICENSE",
|
@@ -305,9 +305,9 @@ for a complete description of the features and enhancements available
|
|
305
305
|
in version 3.2 of the Ruby Agent.
|
306
306
|
|
307
307
|
}
|
308
|
-
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "New Relic Ruby Agent"]
|
309
|
-
s.require_paths = ["lib"]
|
310
308
|
s.rubygems_version = %q{1.3.6}
|
309
|
+
s.rdoc_options = [%q{--line-numbers}, %q{--inline-source}, %q{--title}, %q{New Relic Ruby Agent}]
|
310
|
+
s.require_paths = [%q{lib}]
|
311
311
|
s.summary = %q{New Relic Ruby Agent}
|
312
312
|
|
313
313
|
if s.respond_to? :specification_version then
|
@@ -207,19 +207,22 @@ class NewRelic::Agent::Agent::ConnectTest < Test::Unit::TestCase
|
|
207
207
|
end
|
208
208
|
|
209
209
|
def test_config_transaction_tracer
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
self.expects(:apdex_f_threshold?).returns(true)
|
221
|
-
self.expects(:apdex_f)
|
210
|
+
NewRelic::Control.instance.settings['transaction_tracer'] = {
|
211
|
+
'enabled' => true,
|
212
|
+
'random_sample' => false,
|
213
|
+
'explain_threshold' => 0.75,
|
214
|
+
'explain_enabled' => true
|
215
|
+
}
|
216
|
+
|
217
|
+
@transaction_sampler = NewRelic::Agent::TransactionSampler.new
|
218
|
+
@sql_sampler = NewRelic::Agent::SqlSampler.new
|
219
|
+
|
222
220
|
config_transaction_tracer
|
221
|
+
|
222
|
+
assert @transaction_sampler.enabled?
|
223
|
+
assert_equal 0.75, @transaction_sampler.explain_threshold
|
224
|
+
assert @transaction_sampler.explain_enabled
|
225
|
+
# assert_equal 1.5, @transaction_sampler.transaction_threshold
|
223
226
|
end
|
224
227
|
|
225
228
|
def test_configure_transaction_tracer_with_random_sampling
|
@@ -319,8 +322,7 @@ class NewRelic::Agent::Agent::ConnectTest < Test::Unit::TestCase
|
|
319
322
|
end
|
320
323
|
|
321
324
|
def test_sampler_config
|
322
|
-
|
323
|
-
control.expects(:fetch).with('transaction_tracer', {})
|
325
|
+
NewRelic::Control.instance.expects(:fetch).with('transaction_tracer', {})
|
324
326
|
sampler_config
|
325
327
|
end
|
326
328
|
|
@@ -365,12 +367,12 @@ class NewRelic::Agent::Agent::ConnectTest < Test::Unit::TestCase
|
|
365
367
|
'collect_errors' => true,
|
366
368
|
'sample_rate' => 10
|
367
369
|
}
|
368
|
-
|
369
|
-
control.expects(:fetch).with('transaction_tracer', {}).returns({'enabled' => true}).at_least_once
|
370
|
+
NewRelic::Control.instance.settings['transaction_tracer'] = {'enabled' => true}
|
370
371
|
self.expects(:log_connection!).with(config)
|
371
372
|
self.expects(:configure_transaction_tracer!).with(true, 10)
|
372
373
|
self.expects(:configure_error_collector!).with(true)
|
373
374
|
@transaction_sampler = mock('transaction sampler', :configure! => true)
|
375
|
+
@sql_sampler = mock('sql sampler', :configure! => true)
|
374
376
|
finish_setup(config)
|
375
377
|
assert_equal 'fishsticks', @agent_id
|
376
378
|
assert_equal 'pasta sauce', @report_period
|
@@ -105,8 +105,8 @@ class NewRelic::Agent::Agent::StartTest < Test::Unit::TestCase
|
|
105
105
|
def test_install_exit_handler_positive
|
106
106
|
control = mocked_control
|
107
107
|
control.expects(:send_data_on_exit).returns(true)
|
108
|
-
NewRelic::LanguageSupport.expects(:
|
109
|
-
NewRelic::LanguageSupport.expects(:
|
108
|
+
NewRelic::LanguageSupport.expects(:using_engine?).with('rbx').returns(false)
|
109
|
+
NewRelic::LanguageSupport.expects(:using_engine?).with('jruby').returns(false)
|
110
110
|
self.expects(:using_sinatra?).returns(false)
|
111
111
|
# we are overriding at_exit above, to immediately return, so we can
|
112
112
|
# test the shutdown logic. It's somewhat unfortunate, but we can't
|
@@ -124,14 +124,14 @@ class NewRelic::Agent::Agent::StartTest < Test::Unit::TestCase
|
|
124
124
|
def test_install_exit_handler_weird_ruby
|
125
125
|
control = mocked_control
|
126
126
|
control.expects(:send_data_on_exit).times(3).returns(true)
|
127
|
-
NewRelic::LanguageSupport.expects(:
|
128
|
-
NewRelic::LanguageSupport.expects(:
|
127
|
+
NewRelic::LanguageSupport.expects(:using_engine?).with('rbx').returns(false)
|
128
|
+
NewRelic::LanguageSupport.expects(:using_engine?).with('jruby').returns(false)
|
129
129
|
self.expects(:using_sinatra?).returns(true)
|
130
130
|
install_exit_handler
|
131
|
-
NewRelic::LanguageSupport.expects(:
|
132
|
-
NewRelic::LanguageSupport.expects(:
|
131
|
+
NewRelic::LanguageSupport.expects(:using_engine?).with('rbx').returns(false)
|
132
|
+
NewRelic::LanguageSupport.expects(:using_engine?).with('jruby').returns(true)
|
133
133
|
install_exit_handler
|
134
|
-
NewRelic::LanguageSupport.expects(:
|
134
|
+
NewRelic::LanguageSupport.expects(:using_engine?).with('rbx').returns(true)
|
135
135
|
install_exit_handler
|
136
136
|
end
|
137
137
|
|
@@ -75,8 +75,8 @@ var e=document.createElement("script");'
|
|
75
75
|
end
|
76
76
|
|
77
77
|
def test_browser_timing_footer_without_calling_header
|
78
|
-
|
79
|
-
assert_equal "",
|
78
|
+
Thread.current[:newrelic_start_time] = nil
|
79
|
+
assert_equal "", browser_timing_footer
|
80
80
|
end
|
81
81
|
|
82
82
|
def test_browser_timing_footer_with_no_browser_key_rum_enabled
|
@@ -95,7 +95,7 @@ class NewRelic::Agent::SqlSamplerTest < Test::Unit::TestCase
|
|
95
95
|
data = NewRelic::Agent::TransactionSqlData.new
|
96
96
|
data.set_transaction_info "WebTransaction/Controller/c/a", "/c/a", {}
|
97
97
|
queries = [
|
98
|
-
NewRelic::Agent::SlowSql.new("select
|
98
|
+
NewRelic::Agent::SlowSql.new("select * from test where foo in (1, 2) ", "Database/test/select", {}, 1.5),
|
99
99
|
NewRelic::Agent::SlowSql.new("select * from test where foo in (1,2, 3 ,4, 5,6, 'snausage')", "Database/test/select", {}, 1.2),
|
100
100
|
NewRelic::Agent::SlowSql.new("select * from test2 where foo in (1,2)", "Database/test2/select", {}, 1.1)
|
101
101
|
]
|
@@ -132,4 +132,29 @@ class NewRelic::Agent::SqlSamplerTest < Test::Unit::TestCase
|
|
132
132
|
assert_equal(["bar0", "bar1", "bar2"],
|
133
133
|
sql_traces[1].params[:explain_plan][1][0].sort)
|
134
134
|
end
|
135
|
+
|
136
|
+
def test_should_not_collect_explain_plans_when_disabled
|
137
|
+
NewRelic::Control.instance['slow_sql'] = { 'explain_enabled' => false }
|
138
|
+
data = NewRelic::Agent::TransactionSqlData.new
|
139
|
+
data.set_transaction_info "WebTransaction/Controller/c/a", "/c/a", {}
|
140
|
+
|
141
|
+
queries = [
|
142
|
+
NewRelic::Agent::SlowSql.new("select * from test", "Database/test/select", {}, 1.5)
|
143
|
+
]
|
144
|
+
data.sql_data.concat(queries)
|
145
|
+
@sampler.harvest_slow_sql data
|
146
|
+
sql_traces = @sampler.harvest
|
147
|
+
assert_equal(nil, sql_traces[0].params[:explain_plan])
|
148
|
+
NewRelic::Control.instance['slow_sql'] = { 'explain_enabled' => true }
|
149
|
+
end
|
150
|
+
|
151
|
+
def test_sql_id_fits_in_a_mysql_int_11
|
152
|
+
sql_trace = NewRelic::Agent::SqlTrace.new("select * from test",
|
153
|
+
NewRelic::Agent::SlowSql.new("select * from test",
|
154
|
+
"Database/test/select", {}, 1.2),
|
155
|
+
"tx_name", "uri")
|
156
|
+
|
157
|
+
assert -2147483648 <= sql_trace.sql_id, "sql_id too small"
|
158
|
+
assert 2147483647 >= sql_trace.sql_id, "sql_id too large"
|
159
|
+
end
|
135
160
|
end
|
@@ -9,6 +9,7 @@ class NewRelic::Agent::MetricStatsTest < Test::Unit::TestCase
|
|
9
9
|
puts e
|
10
10
|
puts e.backtrace.join("\n")
|
11
11
|
end
|
12
|
+
|
12
13
|
def teardown
|
13
14
|
@engine.harvest_timeslice_data({},{})
|
14
15
|
super
|
@@ -28,6 +29,7 @@ class NewRelic::Agent::MetricStatsTest < Test::Unit::TestCase
|
|
28
29
|
end
|
29
30
|
|
30
31
|
def test_harvest
|
32
|
+
@engine.clear_stats
|
31
33
|
s1 = @engine.get_stats "a"
|
32
34
|
s2 = @engine.get_stats "c"
|
33
35
|
|
@@ -35,47 +37,46 @@ class NewRelic::Agent::MetricStatsTest < Test::Unit::TestCase
|
|
35
37
|
s2.trace_call 1
|
36
38
|
s2.trace_call 3
|
37
39
|
|
38
|
-
|
39
|
-
|
40
|
+
assert_equal 1, @engine.get_stats("a").call_count
|
41
|
+
assert_equal 10, @engine.get_stats("a").total_call_time
|
40
42
|
|
41
|
-
|
42
|
-
|
43
|
+
assert_equal 2, @engine.get_stats("c").call_count
|
44
|
+
assert_equal 4, @engine.get_stats("c").total_call_time
|
43
45
|
|
44
46
|
metric_data = @engine.harvest_timeslice_data({}, {}).values
|
45
|
-
|
47
|
+
|
46
48
|
# after harvest, all the metrics should be reset
|
47
|
-
|
48
|
-
|
49
|
+
assert_equal 0, @engine.get_stats("a").call_count
|
50
|
+
assert_equal 0, @engine.get_stats("a").total_call_time
|
49
51
|
|
50
|
-
|
51
|
-
|
52
|
+
assert_equal 0, @engine.get_stats("c").call_count
|
53
|
+
assert_equal 0, @engine.get_stats("c").total_call_time
|
52
54
|
|
53
55
|
metric_data = metric_data.reverse if metric_data[0].metric_spec.name != "a"
|
54
56
|
|
55
|
-
|
57
|
+
assert_equal 'a', metric_data[0].metric_spec.name
|
56
58
|
|
57
|
-
|
58
|
-
|
59
|
+
assert_equal 1, metric_data[0].stats.call_count
|
60
|
+
assert_equal 10, metric_data[0].stats.total_call_time
|
59
61
|
end
|
60
62
|
|
61
63
|
def test_harvest_with_merge
|
62
64
|
s = @engine.get_stats "a"
|
63
65
|
s.trace_call 1
|
64
66
|
|
65
|
-
|
67
|
+
assert_equal 1, @engine.get_stats("a").call_count
|
66
68
|
|
67
69
|
harvest = @engine.harvest_timeslice_data({}, {})
|
68
|
-
|
70
|
+
assert_equal 0, s.call_count
|
69
71
|
s.trace_call 2
|
70
|
-
|
72
|
+
assert_equal 1, s.call_count
|
71
73
|
|
72
74
|
# this calk should merge the contents of the previous harvest,
|
73
75
|
# so the stats for metric "a" should have 2 data points
|
74
76
|
harvest = @engine.harvest_timeslice_data(harvest, {})
|
75
77
|
stats = harvest.fetch(NewRelic::MetricSpec.new("a")).stats
|
76
|
-
|
77
|
-
|
78
|
+
assert_equal 2, stats.call_count
|
79
|
+
assert_equal 3, stats.total_call_time
|
78
80
|
end
|
79
|
-
|
80
81
|
end
|
81
82
|
|
@@ -650,6 +650,7 @@ class NewRelic::Agent::TransactionSamplerTest < Test::Unit::TestCase
|
|
650
650
|
@sampler.expects(:disabled).returns(false)
|
651
651
|
@sampler.send(:start_builder)
|
652
652
|
assert_equal(fake_builder, Thread.current[:transaction_sample_builder], "should not overwrite an existing transaction sample builder")
|
653
|
+
Thread.current[:transaction_sample_builder] = nil
|
653
654
|
end
|
654
655
|
|
655
656
|
def test_builder
|
@@ -12,7 +12,7 @@ class NewRelic::Control::ConfigurationTest < Test::Unit::TestCase
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def teardown
|
15
|
-
NewRelic::Control.instance.settings.delete
|
15
|
+
NewRelic::Control.instance.settings.delete('log_file_path')
|
16
16
|
end
|
17
17
|
|
18
18
|
def test_license_key_defaults_to_env_variable
|
@@ -37,6 +37,7 @@ class NewRelic::Control::ConfigurationTest < Test::Unit::TestCase
|
|
37
37
|
NewRelic::Control.instance.setup_log
|
38
38
|
assert_match(/\/lerg\/newrelic_agent.log/,
|
39
39
|
NewRelic::Control.instance.log_file)
|
40
|
+
NewRelic::Control.instance.settings.delete('log_file_path') # = nil
|
40
41
|
end
|
41
42
|
|
42
43
|
def test_server_side_config_ignores_yaml
|
@@ -1,22 +1,22 @@
|
|
1
1
|
require File.expand_path(File.join(File.dirname(__FILE__),'/../test_helper'))
|
2
2
|
class NewRelic::ControlTest < Test::Unit::TestCase
|
3
3
|
|
4
|
-
attr_reader :
|
4
|
+
attr_reader :control
|
5
5
|
|
6
6
|
def setup
|
7
|
-
|
8
7
|
NewRelic::Agent.manual_start(:dispatcher_instance_id => 'test')
|
9
|
-
@
|
8
|
+
@control = NewRelic::Control.instance
|
10
9
|
raise 'oh geez, wrong class' unless NewRelic::Control.instance.is_a?(::NewRelic::Control::Frameworks::Test)
|
11
10
|
end
|
11
|
+
|
12
12
|
def shutdown
|
13
13
|
NewRelic::Agent.shutdown
|
14
14
|
end
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
16
|
+
# def test_cert_file_path
|
17
|
+
# assert @control.cert_file_path
|
18
|
+
# assert_equal File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'cert', 'cacert.pem')), @control.cert_file_path
|
19
|
+
# end
|
20
20
|
|
21
21
|
# This test does not actually use the ruby agent in any way - it's
|
22
22
|
# testing that the CA file we ship actually validates our server's
|
@@ -27,7 +27,7 @@ class NewRelic::ControlTest < Test::Unit::TestCase
|
|
27
27
|
|
28
28
|
s = TCPSocket.new 'collector.newrelic.com', 443
|
29
29
|
ctx = OpenSSL::SSL::SSLContext.new
|
30
|
-
ctx.ca_file = @
|
30
|
+
ctx.ca_file = @control.cert_file_path
|
31
31
|
ctx.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
32
32
|
s = OpenSSL::SSL::SSLSocket.new s, ctx
|
33
33
|
s.connect
|
@@ -43,7 +43,7 @@ class NewRelic::ControlTest < Test::Unit::TestCase
|
|
43
43
|
|
44
44
|
s = TCPSocket.new 'staging-collector.newrelic.com', 443
|
45
45
|
ctx = OpenSSL::SSL::SSLContext.new
|
46
|
-
ctx.ca_file = @
|
46
|
+
ctx.ca_file = @control.cert_file_path
|
47
47
|
ctx.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
48
48
|
s = OpenSSL::SSL::SSLSocket.new s, ctx
|
49
49
|
s.connect
|
@@ -51,39 +51,39 @@ class NewRelic::ControlTest < Test::Unit::TestCase
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def test_monitor_mode
|
54
|
-
assert ! @
|
55
|
-
@
|
56
|
-
@
|
57
|
-
assert !@
|
58
|
-
@
|
59
|
-
assert ! @
|
60
|
-
@
|
61
|
-
assert @
|
62
|
-
@
|
63
|
-
assert !@
|
64
|
-
@
|
65
|
-
assert !@
|
66
|
-
@
|
67
|
-
assert @
|
54
|
+
assert ! @control.monitor_mode?
|
55
|
+
@control.settings.delete 'enabled'
|
56
|
+
@control.settings.delete 'monitor_mode'
|
57
|
+
assert !@control.monitor_mode?
|
58
|
+
@control['enabled'] = false
|
59
|
+
assert ! @control.monitor_mode?
|
60
|
+
@control['enabled'] = true
|
61
|
+
assert @control.monitor_mode?
|
62
|
+
@control['monitor_mode'] = nil
|
63
|
+
assert !@control.monitor_mode?
|
64
|
+
@control['monitor_mode'] = false
|
65
|
+
assert !@control.monitor_mode?
|
66
|
+
@control['monitor_mode'] = true
|
67
|
+
assert @control.monitor_mode?
|
68
68
|
ensure
|
69
|
-
@
|
70
|
-
@
|
69
|
+
@control['enabled'] = false
|
70
|
+
@control['monitor_mode'] = false
|
71
71
|
end
|
72
72
|
|
73
73
|
def test_test_config
|
74
74
|
if defined?(Rails) && Rails::VERSION::MAJOR.to_i == 3
|
75
|
-
assert_equal :rails3,
|
75
|
+
assert_equal :rails3, control.app
|
76
76
|
elsif defined?(Rails)
|
77
|
-
assert_equal :rails,
|
77
|
+
assert_equal :rails, control.app
|
78
78
|
else
|
79
|
-
assert_equal :test,
|
79
|
+
assert_equal :test, control.app
|
80
80
|
end
|
81
|
-
assert_equal :test,
|
82
|
-
assert_match /test/i,
|
83
|
-
assert("" ==
|
84
|
-
assert !
|
85
|
-
assert_equal false,
|
86
|
-
|
81
|
+
assert_equal :test, control.framework
|
82
|
+
assert_match /test/i, control.dispatcher_instance_id
|
83
|
+
assert("" == control.dispatcher.to_s, "Expected dispatcher to be empty, but was #{control.dispatcher.to_s}")
|
84
|
+
assert !control['enabled']
|
85
|
+
assert_equal false, control['monitor_mode']
|
86
|
+
control.local_env
|
87
87
|
end
|
88
88
|
|
89
89
|
def test_root
|
@@ -101,10 +101,10 @@ class NewRelic::ControlTest < Test::Unit::TestCase
|
|
101
101
|
end
|
102
102
|
|
103
103
|
def test_resolve_ip
|
104
|
-
assert_equal nil,
|
105
|
-
assert_equal nil,
|
104
|
+
assert_equal nil, control.send(:convert_to_ip_address, 'localhost')
|
105
|
+
assert_equal nil, control.send(:convert_to_ip_address, 'q1239988737.us')
|
106
106
|
# This will fail if you don't have a valid, accessible, DNS server
|
107
|
-
assert_equal '204.93.223.153',
|
107
|
+
assert_equal '204.93.223.153', control.send(:convert_to_ip_address, 'collector.newrelic.com')
|
108
108
|
end
|
109
109
|
|
110
110
|
class FakeResolv
|
@@ -120,7 +120,7 @@ class NewRelic::ControlTest < Test::Unit::TestCase
|
|
120
120
|
old_ipsocket = IPSocket
|
121
121
|
Object.instance_eval { remove_const :Resolv}
|
122
122
|
Object.instance_eval {remove_const:'IPSocket' }
|
123
|
-
assert_equal(nil,
|
123
|
+
assert_equal(nil, control.send(:convert_to_ip_address, 'collector.newrelic.com'), "DNS is down, should be no IP for server")
|
124
124
|
|
125
125
|
Object.instance_eval {const_set('Resolv', old_resolv); const_set('IPSocket', old_ipsocket)}
|
126
126
|
# these are here to make sure that the constant tomfoolery above
|
@@ -129,12 +129,10 @@ class NewRelic::ControlTest < Test::Unit::TestCase
|
|
129
129
|
assert_equal old_ipsocket, IPSocket
|
130
130
|
end
|
131
131
|
|
132
|
-
|
133
|
-
|
134
132
|
def test_config_yaml_erb
|
135
|
-
assert_equal 'heyheyhey',
|
136
|
-
assert_equal '',
|
137
|
-
assert_equal '',
|
133
|
+
assert_equal 'heyheyhey', control['erb_value']
|
134
|
+
assert_equal '', control['message']
|
135
|
+
assert_equal '', control['license_key']
|
138
136
|
end
|
139
137
|
|
140
138
|
def test_appnames
|
@@ -142,22 +140,25 @@ class NewRelic::ControlTest < Test::Unit::TestCase
|
|
142
140
|
end
|
143
141
|
|
144
142
|
def test_config_booleans
|
145
|
-
assert_equal
|
146
|
-
assert_equal
|
147
|
-
assert_nil
|
148
|
-
assert_equal
|
149
|
-
assert_equal
|
143
|
+
assert_equal control['tval'], true
|
144
|
+
assert_equal control['fval'], false
|
145
|
+
assert_nil control['not_in_yaml_val']
|
146
|
+
assert_equal control['yval'], true
|
147
|
+
assert_equal control['sval'], 'sure'
|
150
148
|
end
|
149
|
+
|
151
150
|
def test_config_apdex
|
152
|
-
assert_equal 1.1,
|
151
|
+
assert_equal 1.1, control.apdex_t
|
153
152
|
end
|
153
|
+
|
154
154
|
# def test_transaction_threshold
|
155
155
|
# assert_equal 'Apdex_f', c['transaction_tracer']['transaction_threshold']
|
156
156
|
# assert_equal 4.4, NewRelic::Agent::Agent.instance.instance_variable_get('@slowest_transaction_threshold')
|
157
157
|
# end
|
158
|
+
|
158
159
|
def test_log_file_name
|
159
160
|
NewRelic::Control.instance.setup_log
|
160
|
-
assert_match /newrelic_agent.log$/,
|
161
|
+
assert_match /newrelic_agent.log$/, control.instance_variable_get('@log_file')
|
161
162
|
end
|
162
163
|
|
163
164
|
# def test_transaction_threshold__apdex
|
@@ -167,25 +168,57 @@ class NewRelic::ControlTest < Test::Unit::TestCase
|
|
167
168
|
# end
|
168
169
|
|
169
170
|
def test_transaction_threshold__default
|
170
|
-
|
171
171
|
forced_start :transaction_tracer => { :transaction_threshold => nil}
|
172
|
-
assert_nil
|
172
|
+
assert_nil control['transaction_tracer']['transaction_threshold']
|
173
173
|
assert_equal 2.0, NewRelic::Agent::Agent.instance.instance_variable_get('@slowest_transaction_threshold')
|
174
174
|
end
|
175
175
|
|
176
176
|
def test_transaction_threshold__override
|
177
177
|
forced_start :transaction_tracer => { :transaction_threshold => 1}
|
178
|
-
assert_equal 1,
|
178
|
+
assert_equal 1, control['transaction_tracer']['transaction_threshold']
|
179
179
|
assert_equal 1, NewRelic::Agent::Agent.instance.instance_variable_get('@slowest_transaction_threshold')
|
180
180
|
end
|
181
|
+
|
182
|
+
def test_transaction_tracer_disabled
|
183
|
+
forced_start(:transaction_tracer => { :enabled => false },
|
184
|
+
:developer_mode => false, :monitor_mode => true)
|
185
|
+
NewRelic::Agent::Agent.instance.check_transaction_sampler_status
|
186
|
+
|
187
|
+
assert(!NewRelic::Agent::Agent.instance.transaction_sampler.enabled?,
|
188
|
+
'transaction tracer enabled when config calls for disabled')
|
189
|
+
|
190
|
+
@control['developer_mode'] = true
|
191
|
+
@control['monitor_mode'] = false
|
192
|
+
end
|
193
|
+
|
194
|
+
def test_sql_tracer_disabled
|
195
|
+
forced_start(:slow_sql => { :enabled => false }, :monitor_mode => true)
|
196
|
+
NewRelic::Agent::Agent.instance.check_sql_sampler_status
|
197
|
+
|
198
|
+
assert(!NewRelic::Agent::Agent.instance.sql_sampler.enabled?,
|
199
|
+
'sql tracer enabled when config calls for disabled')
|
200
|
+
|
201
|
+
@control['monitor_mode'] = false
|
202
|
+
end
|
203
|
+
|
204
|
+
def test_sql_tracer_disabled_with_record_sql_false
|
205
|
+
forced_start(:slow_sql => { :enabled => true, :record_sql => 'off' })
|
206
|
+
NewRelic::Agent::Agent.instance.check_sql_sampler_status
|
207
|
+
|
208
|
+
assert(!NewRelic::Agent::Agent.instance.sql_sampler.enabled?,
|
209
|
+
'sql tracer enabled when config calls for disabled')
|
210
|
+
end
|
211
|
+
|
181
212
|
def test_merging_options
|
182
213
|
NewRelic::Control.send :public, :merge_options
|
183
|
-
@
|
214
|
+
@control.merge_options :api_port => 66, :transaction_tracer => { :explain_threshold => 2.0 }
|
184
215
|
assert_equal 66, NewRelic::Control.instance['api_port']
|
185
216
|
assert_equal 2.0, NewRelic::Control.instance['transaction_tracer']['explain_threshold']
|
186
217
|
assert_equal 'raw', NewRelic::Control.instance['transaction_tracer']['record_sql']
|
187
218
|
end
|
219
|
+
|
188
220
|
private
|
221
|
+
|
189
222
|
def forced_start overrides = {}
|
190
223
|
NewRelic::Agent.manual_start overrides
|
191
224
|
# This is to force the agent to start again.
|
@@ -16,6 +16,7 @@ class NewRelic::DataSerializationTest < Test::Unit::TestCase
|
|
16
16
|
def teardown
|
17
17
|
# this gets set to true in some tests
|
18
18
|
NewRelic::Control.instance['disable_serialization'] = false
|
19
|
+
mocha_teardown
|
19
20
|
end
|
20
21
|
|
21
22
|
def test_read_and_write_from_file_read_only
|
@@ -71,7 +72,6 @@ class NewRelic::DataSerializationTest < Test::Unit::TestCase
|
|
71
72
|
end
|
72
73
|
|
73
74
|
def test_should_send_data_when_over_limit
|
74
|
-
# NewRelic::DataSerialization.expects(:max_size).returns(20)
|
75
75
|
NewRelic::DataSerialization.stubs(:max_size).returns(20)
|
76
76
|
NewRelic::DataSerialization.read_and_write_to_file do
|
77
77
|
"a" * 30
|
@@ -103,17 +103,18 @@ class NewRelic::DataSerializationTest < Test::Unit::TestCase
|
|
103
103
|
end
|
104
104
|
|
105
105
|
def test_should_send_data_disabled
|
106
|
-
NewRelic::Control.instance.
|
107
|
-
assert(NewRelic::DataSerialization.should_send_data?,
|
106
|
+
NewRelic::Control.instance.disable_serialization = true
|
107
|
+
assert(NewRelic::DataSerialization.should_send_data?,
|
108
|
+
'should send data when disabled')
|
108
109
|
end
|
109
110
|
|
110
111
|
def test_should_send_data_under_limit
|
111
112
|
NewRelic::DataSerialization.expects(:max_size).returns(2000)
|
112
|
-
NewRelic::DataSerialization.read_and_write_to_file do |
|
113
|
+
NewRelic::DataSerialization.read_and_write_to_file do |old_data|
|
113
114
|
"a" * 5
|
114
115
|
end
|
115
116
|
|
116
|
-
assert(!NewRelic::DataSerialization.
|
117
|
+
assert(!NewRelic::DataSerialization.store_too_large?,
|
117
118
|
'Should be under the limit')
|
118
119
|
end
|
119
120
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: newrelic_rpm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.2.0.
|
4
|
+
version: 3.2.0.beta2
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -12,12 +12,11 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2011-
|
16
|
-
default_executable:
|
15
|
+
date: 2011-10-13 00:00:00.000000000Z
|
17
16
|
dependencies:
|
18
17
|
- !ruby/object:Gem::Dependency
|
19
18
|
name: jeweler
|
20
|
-
requirement: &
|
19
|
+
requirement: &2153262420 !ruby/object:Gem::Requirement
|
21
20
|
none: false
|
22
21
|
requirements:
|
23
22
|
- - ! '>='
|
@@ -25,10 +24,10 @@ dependencies:
|
|
25
24
|
version: '0'
|
26
25
|
type: :development
|
27
26
|
prerelease: false
|
28
|
-
version_requirements: *
|
27
|
+
version_requirements: *2153262420
|
29
28
|
- !ruby/object:Gem::Dependency
|
30
29
|
name: mocha
|
31
|
-
requirement: &
|
30
|
+
requirement: &2153261700 !ruby/object:Gem::Requirement
|
32
31
|
none: false
|
33
32
|
requirements:
|
34
33
|
- - ! '>='
|
@@ -36,10 +35,10 @@ dependencies:
|
|
36
35
|
version: '0'
|
37
36
|
type: :development
|
38
37
|
prerelease: false
|
39
|
-
version_requirements: *
|
38
|
+
version_requirements: *2153261700
|
40
39
|
- !ruby/object:Gem::Dependency
|
41
40
|
name: shoulda
|
42
|
-
requirement: &
|
41
|
+
requirement: &2153261000 !ruby/object:Gem::Requirement
|
43
42
|
none: false
|
44
43
|
requirements:
|
45
44
|
- - ! '>='
|
@@ -47,7 +46,7 @@ dependencies:
|
|
47
46
|
version: '0'
|
48
47
|
type: :development
|
49
48
|
prerelease: false
|
50
|
-
version_requirements: *
|
49
|
+
version_requirements: *2153261000
|
51
50
|
description: ! 'New Relic is a performance management system, developed by New Relic,
|
52
51
|
|
53
52
|
Inc (http://www.newrelic.com). New Relic provides you with deep
|
@@ -329,7 +328,6 @@ files:
|
|
329
328
|
- vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/web_frontend.rb
|
330
329
|
- vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/web_service.rb
|
331
330
|
- vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/web_transaction.rb
|
332
|
-
has_rdoc: true
|
333
331
|
homepage: http://www.github.com/newrelic/rpm
|
334
332
|
licenses: []
|
335
333
|
post_install_message: ! "\nPLEASE NOTE:\n\nDeveloper Mode is now a Rack middleware.\n\nDeveloper
|
@@ -362,7 +360,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
362
360
|
version: '0'
|
363
361
|
requirements: []
|
364
362
|
rubyforge_project:
|
365
|
-
rubygems_version: 1.6
|
363
|
+
rubygems_version: 1.8.6
|
366
364
|
signing_key:
|
367
365
|
specification_version: 3
|
368
366
|
summary: New Relic Ruby Agent
|