newrelic_rpm 3.5.4.33 → 3.5.4.34
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/new_relic/agent/agent.rb +1 -1
- data/lib/new_relic/agent/pipe_channel_manager.rb +1 -1
- data/lib/new_relic/agent/stats_engine/samplers.rb +1 -1
- data/lib/new_relic/agent/thread.rb +1 -1
- data/lib/new_relic/agent/thread_profiler.rb +4 -4
- data/test/new_relic/agent/thread_test.rb +12 -12
- data/test/new_relic/agent/threaded_test.rb +3 -3
- metadata +2 -2
@@ -596,7 +596,7 @@ module NewRelic
|
|
596
596
|
# See #connect for a description of connection_options.
|
597
597
|
def start_worker_thread(connection_options = {})
|
598
598
|
log.debug "Creating Ruby Agent worker thread."
|
599
|
-
@worker_thread = NewRelic::Agent::
|
599
|
+
@worker_thread = NewRelic::Agent::AgentThread.new('Worker Loop') do
|
600
600
|
deferred_work!(connection_options)
|
601
601
|
end
|
602
602
|
end
|
@@ -76,7 +76,7 @@ module NewRelic
|
|
76
76
|
def start
|
77
77
|
return if @started == true
|
78
78
|
@started = true
|
79
|
-
@thread = NewRelic::Agent::
|
79
|
+
@thread = NewRelic::Agent::AgentThread.new('Pipe Channel Manager') do
|
80
80
|
now = nil
|
81
81
|
loop do
|
82
82
|
clean_up_pipes
|
@@ -27,7 +27,7 @@ module Agent
|
|
27
27
|
# start up a thread that will periodically poll for metric samples
|
28
28
|
return if periodic_samplers.empty?
|
29
29
|
|
30
|
-
@sampler_thread = NewRelic::Agent::
|
30
|
+
@sampler_thread = NewRelic::Agent::AgentThread.new('Sampler Tasks') do
|
31
31
|
loop do
|
32
32
|
now = Time.now
|
33
33
|
begin
|
@@ -120,7 +120,7 @@ module NewRelic
|
|
120
120
|
end
|
121
121
|
|
122
122
|
def run
|
123
|
-
|
123
|
+
AgentThread.new('Thread Profiler') do
|
124
124
|
@start_time = now_in_millis
|
125
125
|
|
126
126
|
@worker_loop.run(@interval) do
|
@@ -128,11 +128,11 @@ module NewRelic
|
|
128
128
|
record_supportability_metrics_timed("ThreadProfiler/PollingTime") do
|
129
129
|
|
130
130
|
@poll_count += 1
|
131
|
-
|
131
|
+
AgentThread.list.each do |t|
|
132
132
|
@sample_count += 1
|
133
133
|
|
134
|
-
bucket =
|
135
|
-
backtrace =
|
134
|
+
bucket = AgentThread.bucket_thread(t, @profile_agent_code)
|
135
|
+
backtrace = AgentThread.scrub_backtrace(t, @profile_agent_code)
|
136
136
|
aggregate(backtrace, @traces[bucket]) unless bucket == :ignore
|
137
137
|
end
|
138
138
|
end
|
@@ -4,18 +4,18 @@ require 'new_relic/agent/thread'
|
|
4
4
|
class ThreadTest < Test::Unit::TestCase
|
5
5
|
|
6
6
|
def test_sets_label
|
7
|
-
t = NewRelic::Agent::
|
7
|
+
t = NewRelic::Agent::AgentThread.new("labelled") {}
|
8
8
|
assert_equal "labelled", t[:newrelic_label]
|
9
9
|
end
|
10
10
|
|
11
11
|
def test_bucket_thread_as_agent_when_profiling
|
12
|
-
t = NewRelic::Agent::
|
13
|
-
assert_equal :agent, NewRelic::Agent::
|
12
|
+
t = NewRelic::Agent::AgentThread.new("labelled") {}
|
13
|
+
assert_equal :agent, NewRelic::Agent::AgentThread.bucket_thread(t, true)
|
14
14
|
end
|
15
15
|
|
16
16
|
def test_bucket_thread_as_agent_when_not_profiling
|
17
|
-
t = NewRelic::Agent::
|
18
|
-
assert_equal :ignore, NewRelic::Agent::
|
17
|
+
t = NewRelic::Agent::AgentThread.new("labelled") {}
|
18
|
+
assert_equal :ignore, NewRelic::Agent::AgentThread.bucket_thread(t, false)
|
19
19
|
end
|
20
20
|
|
21
21
|
def test_bucket_thread_as_request
|
@@ -24,7 +24,7 @@ class ThreadTest < Test::Unit::TestCase
|
|
24
24
|
frame.request = "has a request"
|
25
25
|
t[:newrelic_metric_frame] = frame
|
26
26
|
|
27
|
-
assert_equal :request, NewRelic::Agent::
|
27
|
+
assert_equal :request, NewRelic::Agent::AgentThread.bucket_thread(t, DONT_CARE)
|
28
28
|
end
|
29
29
|
|
30
30
|
def test_bucket_thread_as_background
|
@@ -32,25 +32,25 @@ class ThreadTest < Test::Unit::TestCase
|
|
32
32
|
frame = NewRelic::Agent::Instrumentation::MetricFrame.new
|
33
33
|
t[:newrelic_metric_frame] = frame
|
34
34
|
|
35
|
-
assert_equal :background, NewRelic::Agent::
|
35
|
+
assert_equal :background, NewRelic::Agent::AgentThread.bucket_thread(t, DONT_CARE)
|
36
36
|
end
|
37
37
|
|
38
38
|
def test_bucket_thread_as_other_if_nil_frame
|
39
39
|
t = ::Thread.new {}
|
40
40
|
t[:newrelic_metric_frame] = nil
|
41
41
|
|
42
|
-
assert_equal :other, NewRelic::Agent::
|
42
|
+
assert_equal :other, NewRelic::Agent::AgentThread.bucket_thread(t, DONT_CARE)
|
43
43
|
end
|
44
44
|
|
45
45
|
def test_bucket_thread_as_other
|
46
46
|
t = ::Thread.new {}
|
47
|
-
assert_equal :other, NewRelic::Agent::
|
47
|
+
assert_equal :other, NewRelic::Agent::AgentThread.bucket_thread(t, DONT_CARE)
|
48
48
|
end
|
49
49
|
|
50
50
|
def test_runs_block
|
51
51
|
called = false
|
52
52
|
|
53
|
-
t = NewRelic::Agent::
|
53
|
+
t = NewRelic::Agent::AgentThread.new("labelled") { called = true }
|
54
54
|
t.join
|
55
55
|
|
56
56
|
assert called
|
@@ -63,12 +63,12 @@ class ThreadTest < Test::Unit::TestCase
|
|
63
63
|
]
|
64
64
|
|
65
65
|
def test_scrubs_backtrace_when_not_profiling_agent_code
|
66
|
-
result = NewRelic::Agent::
|
66
|
+
result = NewRelic::Agent::AgentThread.scrub_backtrace(stub(:backtrace => TRACE), false)
|
67
67
|
assert_equal [TRACE[0], TRACE[2]], result
|
68
68
|
end
|
69
69
|
|
70
70
|
def test_doesnt_scrub_backtrace_when_profiling_agent_code
|
71
|
-
result = NewRelic::Agent::
|
71
|
+
result = NewRelic::Agent::AgentThread.scrub_backtrace(stub(:backtrace => TRACE), true)
|
72
72
|
assert_equal TRACE, result
|
73
73
|
end
|
74
74
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class ThreadedTest < Test::Unit::TestCase
|
2
2
|
def setup
|
3
|
-
@original_thread_class = NewRelic::Agent::
|
3
|
+
@original_thread_class = NewRelic::Agent::AgentThread
|
4
4
|
swap_thread_class(FakeThread)
|
5
5
|
end
|
6
6
|
|
@@ -18,8 +18,8 @@ class ThreadedTest < Test::Unit::TestCase
|
|
18
18
|
private
|
19
19
|
|
20
20
|
def swap_thread_class(klass)
|
21
|
-
NewRelic::Agent.send(:remove_const, "
|
22
|
-
NewRelic::Agent.const_set("
|
21
|
+
NewRelic::Agent.send(:remove_const, "AgentThread") if NewRelic::Agent.const_defined?("AgentThread")
|
22
|
+
NewRelic::Agent.const_set("AgentThread", klass)
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
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.5.4.
|
4
|
+
version: 3.5.4.34
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2012-12-
|
15
|
+
date: 2012-12-24 00:00:00.000000000 Z
|
16
16
|
dependencies: []
|
17
17
|
description: ! 'New Relic is a performance management system, developed by New Relic,
|
18
18
|
|