newrelic_rpm 2.14.0 → 2.14.1.logging1
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 +9 -1
- data/lib/new_relic/agent.rb +1 -0
- data/lib/new_relic/agent/method_tracer.rb +4 -8
- data/lib/new_relic/control/logging_methods.rb +12 -9
- data/lib/new_relic/version.rb +2 -2
- data/newrelic_rpm.gemspec +3 -3
- data/test/active_record_fixtures.rb +4 -0
- data/test/new_relic/agent/method_tracer/class_methods/add_method_tracer_test.rb +5 -6
- data/test/new_relic/agent/method_tracer_test.rb +18 -0
- data/test/new_relic/agent/stats_engine/metric_stats_test.rb +1 -0
- data/test/new_relic/agent/stats_engine/stats_engine_test.rb +1 -0
- data/test/new_relic/agent/transaction_sampler_test.rb +1 -0
- data/test/new_relic/command/deployments_test.rb +1 -0
- data/test/test_contexts.rb +1 -0
- metadata +51 -21
data/CHANGELOG
CHANGED
@@ -1,4 +1,12 @@
|
|
1
|
-
v2.
|
1
|
+
v2.14.1.logging1
|
2
|
+
* Special debug logging build, for all those fans of War and Peace out there
|
3
|
+
|
4
|
+
v2.14.1
|
5
|
+
* Avoid overriding methods named 'log' when including the MethodTracer module
|
6
|
+
* Ensure that all load paths for 'new_relic/agent' go through 'new_relic/control' first
|
7
|
+
* Remove some debugging output from tests
|
8
|
+
|
9
|
+
v2.14.0
|
2
10
|
* Dependency detection framework to prevent multi-loading or early-loading
|
3
11
|
of instrumentation files
|
4
12
|
|
data/lib/new_relic/agent.rb
CHANGED
@@ -314,19 +314,15 @@ module NewRelic
|
|
314
314
|
"Custom/#{self.name}/#{method_name.to_s}"
|
315
315
|
end
|
316
316
|
|
317
|
-
def log
|
318
|
-
NewRelic::Control.instance.log
|
319
|
-
end
|
320
|
-
|
321
317
|
def method_exists?(method_name)
|
322
318
|
exists = method_defined?(method_name) || private_method_defined?(method_name)
|
323
|
-
log.warn("Did not trace #{self.name}##{method_name} because that method does not exist") unless exists
|
319
|
+
NewRelic::Control.instance.log.warn("Did not trace #{self.name}##{method_name} because that method does not exist") unless exists
|
324
320
|
exists
|
325
321
|
end
|
326
322
|
|
327
323
|
def traced_method_exists?(method_name, metric_name_code)
|
328
324
|
exists = method_defined?(_traced_method_name(method_name, metric_name_code))
|
329
|
-
log.warn("Attempt to trace a method twice with the same metric: Method = #{method_name}, Metric Name = #{metric_name_code}") if exists
|
325
|
+
NewRelic::Control.instance.log.warn("Attempt to trace a method twice with the same metric: Method = #{method_name}, Metric Name = #{metric_name_code}") if exists
|
330
326
|
exists
|
331
327
|
end
|
332
328
|
|
@@ -391,7 +387,7 @@ module NewRelic
|
|
391
387
|
class_eval traced_method, __FILE__, __LINE__
|
392
388
|
alias_method _untraced_method_name(method_name, metric_name_code), method_name
|
393
389
|
alias_method method_name, _traced_method_name(method_name, metric_name_code)
|
394
|
-
log.debug("Traced method: class = #{self.name},"+
|
390
|
+
NewRelic::Control.instance.log.debug("Traced method: class = #{self.name},"+
|
395
391
|
"method = #{method_name}, "+
|
396
392
|
"metric = '#{metric_name_code}'")
|
397
393
|
end
|
@@ -404,7 +400,7 @@ module NewRelic
|
|
404
400
|
if method_defined? "#{_traced_method_name(method_name, metric_name_code)}"
|
405
401
|
alias_method method_name, "#{_untraced_method_name(method_name, metric_name_code)}"
|
406
402
|
undef_method "#{_traced_method_name(method_name, metric_name_code)}"
|
407
|
-
log.debug("removed method tracer #{method_name} #{metric_name_code}\n")
|
403
|
+
NewRelic::Control.instance.log.debug("removed method tracer #{method_name} #{metric_name_code}\n")
|
408
404
|
else
|
409
405
|
raise "No tracer for '#{metric_name_code}' on method '#{method_name}'"
|
410
406
|
end
|
@@ -26,6 +26,7 @@ module NewRelic
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def should_log?
|
29
|
+
return true # debug build! always log, ALWAYS
|
29
30
|
@settings && agent_enabled?
|
30
31
|
end
|
31
32
|
|
@@ -41,15 +42,17 @@ module NewRelic
|
|
41
42
|
end
|
42
43
|
|
43
44
|
# set the log level as specified in the config file
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
45
|
+
|
46
|
+
# debug build! Always log everything!
|
47
|
+
log.level = Logger::DEBUG
|
48
|
+
# case fetch("log_level","info").downcase
|
49
|
+
# when "debug" then log.level = Logger::DEBUG
|
50
|
+
# when "info" then log.level = Logger::INFO
|
51
|
+
# when "warn" then log.level = Logger::WARN
|
52
|
+
# when "error" then log.level = Logger::ERROR
|
53
|
+
# when "fatal" then log.level = Logger::FATAL
|
54
|
+
# else log.level = Logger::INFO
|
55
|
+
# end
|
53
56
|
log
|
54
57
|
end
|
55
58
|
|
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 = 14
|
6
|
-
TINY =
|
7
|
-
BUILD =
|
6
|
+
TINY = 1
|
7
|
+
BUILD = 'logging1' #'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 = "2.14.
|
8
|
+
s.version = "2.14.1.logging1"
|
9
9
|
|
10
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{2011-03-
|
12
|
+
s.date = %q{2011-03-31}
|
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
|
@@ -278,7 +278,7 @@ for instructions for previous versions
|
|
278
278
|
}
|
279
279
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "New Relic Ruby Performance Monitoring Agent"]
|
280
280
|
s.require_paths = ["lib"]
|
281
|
-
s.rubygems_version = %q{1.3.
|
281
|
+
s.rubygems_version = %q{1.3.6}
|
282
282
|
s.summary = %q{New Relic Ruby Performance Monitoring Agent}
|
283
283
|
|
284
284
|
if s.respond_to? :specification_version then
|
@@ -10,6 +10,10 @@ module ActiveRecordFixtures
|
|
10
10
|
def teardown
|
11
11
|
ActiveRecordFixtures::Shipment.teardown
|
12
12
|
ActiveRecordFixtures::Order.teardown
|
13
|
+
begin
|
14
|
+
super
|
15
|
+
rescue Exception => e
|
16
|
+
end
|
13
17
|
end
|
14
18
|
class Order < ActiveRecord::Base
|
15
19
|
self.table_name = 'newrelic_test_orders'
|
@@ -35,8 +35,7 @@ module NewRelic
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def test_default_metric_name_code
|
38
|
-
|
39
|
-
assert_equal 'Custom/TEST_CLASS/test_method', default_metric_name_code('test_method')
|
38
|
+
assert_equal "Custom/#{name}/test_method", default_metric_name_code('test_method')
|
40
39
|
end
|
41
40
|
|
42
41
|
def test_method_exists_positive
|
@@ -47,10 +46,10 @@ module NewRelic
|
|
47
46
|
def test_method_exists_negative
|
48
47
|
self.expects(:method_defined?).returns(false)
|
49
48
|
self.expects(:private_method_defined?).returns(false)
|
50
|
-
|
49
|
+
|
51
50
|
fake_log = mock('log')
|
52
|
-
|
53
|
-
fake_log.expects(:warn).with("Did not trace
|
51
|
+
NewRelic::Control.instance.expects(:log).returns(fake_log)
|
52
|
+
fake_log.expects(:warn).with("Did not trace #{name}#test_method because that method does not exist")
|
54
53
|
assert !method_exists?('test_method')
|
55
54
|
end
|
56
55
|
|
@@ -113,7 +112,7 @@ module NewRelic
|
|
113
112
|
self.expects(:_traced_method_name)
|
114
113
|
self.expects(:method_defined?).returns(true)
|
115
114
|
fake_log = mock('log')
|
116
|
-
|
115
|
+
NewRelic::Control.instance.expects(:log).returns(fake_log)
|
117
116
|
fake_log.expects(:warn).with('Attempt to trace a method twice with the same metric: Method = test_method, Metric Name = Custom/Test/test_method')
|
118
117
|
assert traced_method_exists?('test_method', 'Custom/Test/test_method')
|
119
118
|
end
|
@@ -41,6 +41,20 @@ module NewRelic
|
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
|
+
module TestModuleWithLog
|
45
|
+
extend self
|
46
|
+
def other_method
|
47
|
+
#just here to be traced
|
48
|
+
log "12345"
|
49
|
+
end
|
50
|
+
|
51
|
+
def log( msg )
|
52
|
+
msg
|
53
|
+
end
|
54
|
+
include NewRelic::Agent::MethodTracer
|
55
|
+
add_method_tracer :other_method, 'Custom/foo/bar'
|
56
|
+
end
|
57
|
+
|
44
58
|
class NewRelic::Agent::MethodTracerTest < Test::Unit::TestCase
|
45
59
|
attr_reader :stats_engine
|
46
60
|
|
@@ -66,6 +80,10 @@ class NewRelic::Agent::MethodTracerTest < Test::Unit::TestCase
|
|
66
80
|
@metric_name = nil
|
67
81
|
super
|
68
82
|
end
|
83
|
+
|
84
|
+
def test_preserve_logging
|
85
|
+
assert_equal '12345', TestModuleWithLog.other_method
|
86
|
+
end
|
69
87
|
|
70
88
|
def test_basic
|
71
89
|
metric = "hello"
|
data/test/test_contexts.rb
CHANGED
metadata
CHANGED
@@ -1,8 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: newrelic_rpm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
4
|
+
hash: 897997444
|
5
|
+
prerelease: true
|
6
|
+
segments:
|
7
|
+
- 2
|
8
|
+
- 14
|
9
|
+
- 1
|
10
|
+
- logging1
|
11
|
+
version: 2.14.1.logging1
|
6
12
|
platform: ruby
|
7
13
|
authors:
|
8
14
|
- Bill Kayser
|
@@ -11,7 +17,7 @@ autorequire:
|
|
11
17
|
bindir: bin
|
12
18
|
cert_chain: []
|
13
19
|
|
14
|
-
date: 2011-03-
|
20
|
+
date: 2011-03-31 00:00:00 -07:00
|
15
21
|
default_executable:
|
16
22
|
dependencies:
|
17
23
|
- !ruby/object:Gem::Dependency
|
@@ -22,6 +28,9 @@ dependencies:
|
|
22
28
|
requirements:
|
23
29
|
- - ">="
|
24
30
|
- !ruby/object:Gem::Version
|
31
|
+
hash: 3
|
32
|
+
segments:
|
33
|
+
- 0
|
25
34
|
version: "0"
|
26
35
|
type: :development
|
27
36
|
version_requirements: *id001
|
@@ -33,6 +42,9 @@ dependencies:
|
|
33
42
|
requirements:
|
34
43
|
- - ">="
|
35
44
|
- !ruby/object:Gem::Version
|
45
|
+
hash: 3
|
46
|
+
segments:
|
47
|
+
- 0
|
36
48
|
version: "0"
|
37
49
|
type: :development
|
38
50
|
version_requirements: *id002
|
@@ -44,6 +56,9 @@ dependencies:
|
|
44
56
|
requirements:
|
45
57
|
- - ">="
|
46
58
|
- !ruby/object:Gem::Version
|
59
|
+
hash: 3
|
60
|
+
segments:
|
61
|
+
- 0
|
47
62
|
version: "0"
|
48
63
|
type: :development
|
49
64
|
version_requirements: *id003
|
@@ -294,23 +309,32 @@ has_rdoc: true
|
|
294
309
|
homepage: http://www.github.com/newrelic/rpm
|
295
310
|
licenses: []
|
296
311
|
|
297
|
-
post_install_message:
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
312
|
+
post_install_message: |+
|
313
|
+
|
314
|
+
PLEASE NOTE:
|
315
|
+
|
316
|
+
Developer Mode is now a Rack middleware.
|
317
|
+
|
318
|
+
RPM Developer Mode is no longer available in Rails 2.1 and earlier.
|
319
|
+
However, starting in version 2.12 you can use Developer Mode in any
|
320
|
+
Rack based framework, in addition to Rails. To install developer mode
|
321
|
+
in a non-Rails application, just add NewRelic::Rack::DeveloperMode to
|
322
|
+
your middleware stack.
|
323
|
+
|
324
|
+
If you are using JRuby, we recommend using at least version 1.4 or
|
325
|
+
later because of issues with the implementation of the timeout library.
|
326
|
+
|
327
|
+
Refer to the README.md file for more information.
|
328
|
+
|
329
|
+
Please see http://support.newrelic.com/faqs/docs/ruby-agent-release-notes
|
330
|
+
for a complete description of the features and enhancements available
|
331
|
+
in version 2.14 of the Ruby Agent.
|
332
|
+
|
333
|
+
For details on this specific release, refer to the CHANGELOG file.
|
334
|
+
|
335
|
+
Notice: Developer Mode now supports only Rails 2.3+ - refer to README
|
336
|
+
for instructions for previous versions
|
337
|
+
|
314
338
|
rdoc_options:
|
315
339
|
- --line-numbers
|
316
340
|
- --inline-source
|
@@ -323,17 +347,23 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
323
347
|
requirements:
|
324
348
|
- - ">="
|
325
349
|
- !ruby/object:Gem::Version
|
350
|
+
hash: 3
|
351
|
+
segments:
|
352
|
+
- 0
|
326
353
|
version: "0"
|
327
354
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
328
355
|
none: false
|
329
356
|
requirements:
|
330
357
|
- - ">="
|
331
358
|
- !ruby/object:Gem::Version
|
359
|
+
hash: 3
|
360
|
+
segments:
|
361
|
+
- 0
|
332
362
|
version: "0"
|
333
363
|
requirements: []
|
334
364
|
|
335
365
|
rubyforge_project:
|
336
|
-
rubygems_version: 1.
|
366
|
+
rubygems_version: 1.3.7
|
337
367
|
signing_key:
|
338
368
|
specification_version: 3
|
339
369
|
summary: New Relic Ruby Performance Monitoring Agent
|