newrelic-infinite_tracing 8.11.0 → 8.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/infinite_tracing/agent_integrations/agent.rb +1 -0
- data/lib/infinite_tracing/client.rb +3 -0
- data/lib/infinite_tracing/record_status_handler.rb +2 -0
- data/lib/infinite_tracing/streaming_buffer.rb +14 -2
- data/lib/infinite_tracing/worker.rb +4 -0
- data/newrelic-infinite_tracing.gemspec +1 -0
- metadata +18 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d82f3d8556283da9e25f2789f9e83fac58f65b3df011af7d2adf2fd32894917
|
4
|
+
data.tar.gz: '0995598d2923cafdbc3eb38a663500ea48e37ba207cb6c58a1e8a15dbcb25d58'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2aeb0110716ff65afcc46ef898690cdd951d8318273709840ed303657679dd4fa8110f7dd229fcce0b0a36806d8ced9e16e20297dae1d19f1a4d88093c48f7a2
|
7
|
+
data.tar.gz: d41478145f1891e1f02d5df82bbca1fe711c5d5a99fd352c118e6441635f86cbbf0255b963e791e2d87c1aefb3085a65786306491e89a18032c9907462e6cd0b
|
@@ -33,6 +33,7 @@ module NewRelic::Agent
|
|
33
33
|
# client (if any) and returns self (so we chain the call)
|
34
34
|
def transfer(previous_client)
|
35
35
|
return self unless previous_client
|
36
|
+
|
36
37
|
previous_client.buffer.transfer(buffer)
|
37
38
|
self
|
38
39
|
end
|
@@ -108,6 +109,7 @@ module NewRelic::Agent
|
|
108
109
|
# The Suspended Streaming Buffer will be installed in this state.
|
109
110
|
def suspend
|
110
111
|
return if suspended?
|
112
|
+
|
111
113
|
@lock.synchronize do
|
112
114
|
@suspended = true
|
113
115
|
@buffer = new_streaming_buffer
|
@@ -138,6 +140,7 @@ module NewRelic::Agent
|
|
138
140
|
|
139
141
|
def stop
|
140
142
|
return unless @response_handler
|
143
|
+
|
141
144
|
@lock.synchronize do
|
142
145
|
@response_handler.stop
|
143
146
|
@response_handler = nil
|
@@ -19,6 +19,7 @@ module NewRelic::Agent
|
|
19
19
|
|
20
20
|
def stop
|
21
21
|
return if @worker.nil?
|
22
|
+
|
22
23
|
@lock.synchronize do
|
23
24
|
NewRelic::Agent.logger.debug("gRPC Stopping Response Handler")
|
24
25
|
@worker.stop
|
@@ -31,6 +32,7 @@ module NewRelic::Agent
|
|
31
32
|
def handle_response
|
32
33
|
@enumerator.each do |response|
|
33
34
|
break if response.nil? || response.is_a?(Exception)
|
35
|
+
|
34
36
|
@lock.synchronize do
|
35
37
|
@messages_seen = response
|
36
38
|
NewRelic::Agent.logger.debug("gRPC Infinite Tracer Observer saw #{messages_seen} messages")
|
@@ -17,6 +17,10 @@ module NewRelic::Agent
|
|
17
17
|
DEFAULT_QUEUE_SIZE = 10_000
|
18
18
|
FLUSH_DELAY = 0.005
|
19
19
|
MAX_FLUSH_WAIT = 3 # three seconds
|
20
|
+
# To ensure that two bits of info for the same transaction
|
21
|
+
# are recognized as belonging together, set a maximum time
|
22
|
+
# in seconds to elapse between batch submissions.
|
23
|
+
MAX_BATCH_HOLD = 5
|
20
24
|
|
21
25
|
attr_reader :queue
|
22
26
|
|
@@ -91,6 +95,7 @@ module NewRelic::Agent
|
|
91
95
|
# application thread.
|
92
96
|
def enumerator
|
93
97
|
return enum_for(:enumerator) unless block_given?
|
98
|
+
|
94
99
|
loop do
|
95
100
|
if segment = @queue.pop(false)
|
96
101
|
NewRelic::Agent.increment_metric(SPANS_SENT_METRIC)
|
@@ -116,13 +121,16 @@ module NewRelic::Agent
|
|
116
121
|
# the gRPC call's thread rather than in the main
|
117
122
|
# application thread.
|
118
123
|
def batch_enumerator
|
119
|
-
return enum_for(:
|
124
|
+
return enum_for(:batch_enumerator) unless block_given?
|
125
|
+
|
126
|
+
last_time = Process.clock_gettime(Process::CLOCK_REALTIME)
|
120
127
|
loop do
|
121
128
|
if proc_or_segment = @queue.pop(false)
|
122
129
|
NewRelic::Agent.increment_metric(SPANS_SENT_METRIC)
|
123
130
|
@batch << transform(proc_or_segment)
|
124
|
-
if
|
131
|
+
if batch_ready?(last_time)
|
125
132
|
yield(SpanBatch.new(spans: @batch))
|
133
|
+
last_time = Process.clock_gettime(Process::CLOCK_REALTIME)
|
126
134
|
@batch.clear
|
127
135
|
end
|
128
136
|
|
@@ -135,6 +143,10 @@ module NewRelic::Agent
|
|
135
143
|
|
136
144
|
private
|
137
145
|
|
146
|
+
def batch_ready?(last_time)
|
147
|
+
@batch.size >= BATCH_SIZE || Process.clock_gettime(Process::CLOCK_REALTIME) - last_time >= MAX_BATCH_HOLD
|
148
|
+
end
|
149
|
+
|
138
150
|
def span_event(proc_or_segment)
|
139
151
|
if proc_or_segment.is_a?(Proc)
|
140
152
|
proc_or_segment.call
|
@@ -22,8 +22,10 @@ module NewRelic::Agent
|
|
22
22
|
|
23
23
|
def status
|
24
24
|
return "error" if error?
|
25
|
+
|
25
26
|
@lock.synchronize do
|
26
27
|
return "stopped" if @worker_thread.nil?
|
28
|
+
|
27
29
|
@worker_thread.status || "idle"
|
28
30
|
end
|
29
31
|
end
|
@@ -34,6 +36,7 @@ module NewRelic::Agent
|
|
34
36
|
|
35
37
|
def join(timeout = nil)
|
36
38
|
return unless @worker_thread
|
39
|
+
|
37
40
|
NewRelic::Agent.logger.debug("joining worker #{@name} thread...")
|
38
41
|
@worker_thread.join(timeout)
|
39
42
|
end
|
@@ -41,6 +44,7 @@ module NewRelic::Agent
|
|
41
44
|
def stop
|
42
45
|
@lock.synchronize do
|
43
46
|
return unless @worker_thread
|
47
|
+
|
44
48
|
NewRelic::Agent.logger.debug("stopping worker #{@name} thread...")
|
45
49
|
@worker_thread.kill
|
46
50
|
@worker_thread = nil
|
@@ -78,6 +78,7 @@ Gem or plugin, hosted on https://github.com/newrelic/newrelic-ruby-agent/
|
|
78
78
|
s.add_development_dependency 'rb-inotify', '0.9.10' # locked to support < Ruby 2.3 (and listen 3.0.8)
|
79
79
|
s.add_development_dependency 'listen', '3.0.8' # locked to support < Ruby 2.3
|
80
80
|
s.add_development_dependency 'minitest', '~> 5.15'
|
81
|
+
s.add_development_dependency 'minitest-stub-const', '0.6'
|
81
82
|
s.add_development_dependency 'mocha', '~> 1.9.0'
|
82
83
|
s.add_development_dependency 'pry-nav', '~> 0.3.0'
|
83
84
|
s.add_development_dependency 'pry-stack_explorer', '~> 0.4.9'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: newrelic-infinite_tracing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 8.
|
4
|
+
version: 8.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tanna McClure
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2022-10-
|
14
|
+
date: 2022-10-26 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: newrelic_rpm
|
@@ -19,14 +19,14 @@ dependencies:
|
|
19
19
|
requirements:
|
20
20
|
- - '='
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 8.
|
22
|
+
version: 8.12.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - '='
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 8.
|
29
|
+
version: 8.12.0
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: grpc
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -97,6 +97,20 @@ dependencies:
|
|
97
97
|
- - "~>"
|
98
98
|
- !ruby/object:Gem::Version
|
99
99
|
version: '5.15'
|
100
|
+
- !ruby/object:Gem::Dependency
|
101
|
+
name: minitest-stub-const
|
102
|
+
requirement: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - '='
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0.6'
|
107
|
+
type: :development
|
108
|
+
prerelease: false
|
109
|
+
version_requirements: !ruby/object:Gem::Requirement
|
110
|
+
requirements:
|
111
|
+
- - '='
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: '0.6'
|
100
114
|
- !ruby/object:Gem::Dependency
|
101
115
|
name: mocha
|
102
116
|
requirement: !ruby/object:Gem::Requirement
|