newrelic_rpm 3.6.1.86.beta → 3.6.1.87
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/lib/new_relic/agent/agent.rb +18 -0
- data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +7 -14
- data/lib/new_relic/agent/stats_engine/samplers.rb +22 -17
- data/lib/new_relic/control/instrumentation.rb +1 -16
- data/lib/new_relic/delayed_job_injection.rb +1 -6
- data/test/new_relic/agent/stats_engine/samplers_test.rb +19 -17
- metadata +3 -3
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
@@ -503,6 +503,24 @@ module NewRelic
|
|
503
503
|
@launch_time = Time.now
|
504
504
|
end
|
505
505
|
|
506
|
+
def add_harvest_sampler(subclass)
|
507
|
+
begin
|
508
|
+
::NewRelic::Agent.logger.debug "#{subclass.name} not supported on this platform." and return unless subclass.supported_on_this_platform?
|
509
|
+
sampler = subclass.new
|
510
|
+
if subclass.use_harvest_sampler?
|
511
|
+
stats_engine.add_harvest_sampler sampler
|
512
|
+
::NewRelic::Agent.logger.debug "Registered #{subclass.name} for harvest time sampling"
|
513
|
+
else
|
514
|
+
stats_engine.add_sampler sampler
|
515
|
+
::NewRelic::Agent.logger.debug "Registered #{subclass.name} for periodic sampling"
|
516
|
+
end
|
517
|
+
rescue NewRelic::Agent::Sampler::Unsupported => e
|
518
|
+
::NewRelic::Agent.logger.info "#{subclass} sampler not available: #{e}"
|
519
|
+
rescue => e
|
520
|
+
::NewRelic::Agent.logger.error "Error registering sampler:", e
|
521
|
+
end
|
522
|
+
end
|
523
|
+
|
506
524
|
private
|
507
525
|
|
508
526
|
# All of this module used to be contained in the
|
@@ -34,21 +34,14 @@ DependencyDetection.defer do
|
|
34
34
|
|
35
35
|
executes do
|
36
36
|
Delayed::Job.instance_eval do
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
NewRelic::Agent.after_fork(:force_reconnect => true)
|
41
|
-
after_fork_without_newrelic
|
42
|
-
end
|
37
|
+
# alias_method is for instance, not class methods. But we still want to
|
38
|
+
# call any existing class method we're redefining, so do it the hard way.
|
39
|
+
@original_after_fork = method(:after_fork) if respond_to?(:after_fork)
|
43
40
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
NewRelic::Agent.after_fork(:force_reconnect => true)
|
49
|
-
super
|
50
|
-
end
|
51
|
-
end
|
41
|
+
def after_fork
|
42
|
+
NewRelic::Agent.after_fork(:force_reconnect => true)
|
43
|
+
@original_after_fork.call() if @original_after_fork
|
44
|
+
super
|
52
45
|
end
|
53
46
|
end
|
54
47
|
end
|
@@ -45,17 +45,6 @@ module Agent
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
-
private
|
49
|
-
|
50
|
-
def add_sampler_to(sampler_array, sampler)
|
51
|
-
raise "Sampler #{sampler.inspect} is already registered. Don't call add_sampler directly anymore." if sampler_array.include?(sampler)
|
52
|
-
sampler_array << sampler
|
53
|
-
sampler.stats_engine = self
|
54
|
-
end
|
55
|
-
|
56
|
-
def log_added_sampler(type, sampler)
|
57
|
-
::NewRelic::Agent.logger.debug "Adding #{type} sampler: #{sampler.id}"
|
58
|
-
end
|
59
48
|
|
60
49
|
public
|
61
50
|
|
@@ -72,8 +61,30 @@ module Agent
|
|
72
61
|
log_added_sampler('harvest-time', sampler)
|
73
62
|
end
|
74
63
|
|
64
|
+
def harvest_samplers
|
65
|
+
@harvest_samplers ||= []
|
66
|
+
end
|
67
|
+
|
68
|
+
def periodic_samplers
|
69
|
+
@periodic_samplers ||= []
|
70
|
+
end
|
71
|
+
|
72
|
+
|
75
73
|
private
|
76
74
|
|
75
|
+
def add_sampler_to(sampler_array, sampler)
|
76
|
+
if sampler_array.any? { |s| s.class == sampler.class }
|
77
|
+
NewRelic::Agent.logger.warn "Ignoring addition of #{sampler.inspect} because it is already registered."
|
78
|
+
else
|
79
|
+
sampler_array << sampler
|
80
|
+
sampler.stats_engine = self
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
def log_added_sampler(type, sampler)
|
85
|
+
::NewRelic::Agent.logger.debug "Adding #{type} sampler: #{sampler.id}"
|
86
|
+
end
|
87
|
+
|
77
88
|
# Call poll on each of the samplers. Remove
|
78
89
|
# the sampler if it raises.
|
79
90
|
def poll(samplers)
|
@@ -88,12 +99,6 @@ module Agent
|
|
88
99
|
end
|
89
100
|
end
|
90
101
|
|
91
|
-
def harvest_samplers
|
92
|
-
@harvest_samplers ||= []
|
93
|
-
end
|
94
|
-
def periodic_samplers
|
95
|
-
@periodic_samplers ||= []
|
96
|
-
end
|
97
102
|
end
|
98
103
|
end
|
99
104
|
end
|
@@ -56,23 +56,8 @@ module NewRelic
|
|
56
56
|
# minute. This is dynamically recognized by any class that
|
57
57
|
# subclasses NewRelic::Agent::Sampler
|
58
58
|
def load_samplers
|
59
|
-
agent = NewRelic::Agent.instance
|
60
59
|
NewRelic::Agent::Sampler.sampler_classes.each do | subclass |
|
61
|
-
|
62
|
-
::NewRelic::Agent.logger.debug "#{subclass.name} not supported on this platform." and next if not subclass.supported_on_this_platform?
|
63
|
-
sampler = subclass.new
|
64
|
-
if subclass.use_harvest_sampler?
|
65
|
-
agent.stats_engine.add_harvest_sampler sampler
|
66
|
-
::NewRelic::Agent.logger.debug "Registered #{subclass.name} for harvest time sampling"
|
67
|
-
else
|
68
|
-
agent.stats_engine.add_sampler sampler
|
69
|
-
::NewRelic::Agent.logger.debug "Registered #{subclass.name} for periodic sampling"
|
70
|
-
end
|
71
|
-
rescue NewRelic::Agent::Sampler::Unsupported => e
|
72
|
-
::NewRelic::Agent.logger.info "#{subclass} sampler not available: #{e}"
|
73
|
-
rescue => e
|
74
|
-
::NewRelic::Agent.logger.error "Error registering sampler:", e
|
75
|
-
end
|
60
|
+
NewRelic::Agent.instance.add_harvest_sampler(subclass)
|
76
61
|
end
|
77
62
|
end
|
78
63
|
|
@@ -40,6 +40,7 @@ DependencyDetection.defer do
|
|
40
40
|
say "New Relic Ruby Agent Monitoring DJ worker #{dispatcher_instance_id}"
|
41
41
|
NewRelic::DelayedJobInjection.worker_name = worker_name
|
42
42
|
NewRelic::Control.instance.init_plugin :dispatcher => :delayed_job, :dispatcher_instance_id => dispatcher_instance_id
|
43
|
+
NewRelic::Agent.instance.add_harvest_sampler(NewRelic::Agent::Samplers::DelayedJobSampler)
|
43
44
|
end
|
44
45
|
|
45
46
|
alias initialize_without_new_relic initialize
|
@@ -47,9 +48,3 @@ DependencyDetection.defer do
|
|
47
48
|
end
|
48
49
|
end
|
49
50
|
end
|
50
|
-
|
51
|
-
# If Rails is defined, this gets called in an after_initialize hook
|
52
|
-
# see NewRelic::Control::Frameworks::Rails#init_config
|
53
|
-
unless defined?(Rails)
|
54
|
-
DependencyDetection.detect!
|
55
|
-
end
|
@@ -7,34 +7,36 @@ require 'new_relic/agent/samplers/cpu_sampler'
|
|
7
7
|
|
8
8
|
class NewRelic::Agent::StatsEngine::SamplersTest < Test::Unit::TestCase
|
9
9
|
|
10
|
-
class
|
10
|
+
class OurSamplers
|
11
11
|
include NewRelic::Agent::StatsEngine::Samplers
|
12
12
|
end
|
13
13
|
|
14
|
+
class OurSampler
|
15
|
+
attr_accessor :id, :stats_engine
|
16
|
+
end
|
17
|
+
|
14
18
|
def setup
|
15
19
|
@stats_engine = NewRelic::Agent::StatsEngine.new
|
16
20
|
NewRelic::Agent.instance.stubs(:stats_engine).returns(@stats_engine)
|
17
21
|
end
|
18
22
|
|
19
|
-
def
|
20
|
-
|
21
|
-
sampler =
|
22
|
-
|
23
|
-
|
24
|
-
sampler_array.expects(:<<).with(sampler)
|
25
|
-
sampler.expects(:stats_engine=).with(object)
|
23
|
+
def test_can_add_harvest_sampler
|
24
|
+
samplers = OurSamplers.new
|
25
|
+
sampler = OurSampler.new
|
26
|
+
|
27
|
+
samplers.add_harvest_sampler(sampler)
|
26
28
|
|
27
|
-
|
29
|
+
assert_equal [sampler], samplers.harvest_samplers
|
30
|
+
assert_equal samplers, sampler.stats_engine
|
28
31
|
end
|
29
32
|
|
30
|
-
def
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
end
|
33
|
+
def test_cannot_add_harvest_sampler_twice
|
34
|
+
samplers = OurSamplers.new
|
35
|
+
samplers.add_harvest_sampler(OurSampler.new)
|
36
|
+
first_list = samplers.harvest_samplers.dup
|
37
|
+
|
38
|
+
samplers.add_harvest_sampler(OurSampler.new)
|
39
|
+
assert_equal first_list, samplers.harvest_samplers
|
38
40
|
end
|
39
41
|
|
40
42
|
def test_cpu_sampler_records_user_and_system_time
|
metadata
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: newrelic_rpm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.6.1.
|
5
|
-
prerelease:
|
4
|
+
version: 3.6.1.87
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Jason Clark
|
@@ -41,7 +41,7 @@ cert_chain:
|
|
41
41
|
cHUySWFQWE92bTNUOEc0TzZxWnZobkxoL1VpZW4rK0RqOGVGQmVjVFBvTThw
|
42
42
|
VmpLM3BoNQpuL0V3dVpDY0U2Z2h0Q0NNCi0tLS0tRU5EIENFUlRJRklDQVRF
|
43
43
|
LS0tLS0K
|
44
|
-
date: 2013-04-
|
44
|
+
date: 2013-04-24 00:00:00.000000000 Z
|
45
45
|
dependencies: []
|
46
46
|
description: ! 'New Relic is a performance management system, developed by New Relic,
|
47
47
|
|
metadata.gz.sig
CHANGED
Binary file
|