newrelic-infinite_tracing 8.10.1 → 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/Gemfile +0 -1
- data/Rakefile +0 -1
- data/lib/infinite_tracing/agent_integrations/agent.rb +1 -1
- data/lib/infinite_tracing/agent_integrations/datastore_segment.rb +1 -2
- data/lib/infinite_tracing/agent_integrations/external_request_segment.rb +1 -2
- data/lib/infinite_tracing/agent_integrations/segment.rb +1 -2
- data/lib/infinite_tracing/agent_integrations.rb +0 -1
- data/lib/infinite_tracing/channel.rb +45 -2
- data/lib/infinite_tracing/client.rb +13 -2
- data/lib/infinite_tracing/config.rb +2 -3
- data/lib/infinite_tracing/connection.rb +2 -3
- data/lib/infinite_tracing/constants.rb +0 -1
- data/lib/infinite_tracing/proto/infinite_tracing_pb.rb +0 -1
- data/lib/infinite_tracing/proto/infinite_tracing_services_pb.rb +0 -2
- data/lib/infinite_tracing/proto.rb +0 -1
- data/lib/infinite_tracing/record_status_handler.rb +26 -21
- data/lib/infinite_tracing/streaming_buffer.rb +14 -3
- data/lib/infinite_tracing/suspended_streaming_buffer.rb +0 -1
- data/lib/infinite_tracing/transformer.rb +0 -1
- data/lib/infinite_tracing/version.rb +0 -1
- data/lib/infinite_tracing/worker.rb +4 -1
- data/lib/infinite_tracing.rb +0 -1
- data/lib/new_relic/infinite_tracing.rb +0 -1
- data/lib/newrelic/infinite_tracing.rb +0 -1
- data/lib/proto/infinite_tracing.proto +1 -2
- data/newrelic-infinite_tracing.gemspec +3 -3
- data/tasks/all.rb +0 -1
- data/tasks/helpers/license.rb +25 -0
- data/tasks/proto.rake +4 -25
- metadata +21 -6
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
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# encoding: utf-8
|
2
1
|
# This file is distributed under New Relic's license terms.
|
3
2
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
3
|
# frozen_string_literal: true
|
@@ -34,6 +33,7 @@ module NewRelic::Agent
|
|
34
33
|
def close_infinite_tracer
|
35
34
|
NewRelic::Agent.logger.debug("Closing infinite tracer threads")
|
36
35
|
return unless @infinite_tracer_thread
|
36
|
+
|
37
37
|
@infinite_tracer_thread.join
|
38
38
|
@infinite_tracer_thread.stop
|
39
39
|
@infinite_tracer_thread = nil
|
@@ -1,4 +1,3 @@
|
|
1
|
-
# encoding: utf-8
|
2
1
|
# This file is distributed under New Relic's license terms.
|
3
2
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
3
|
# frozen_string_literal: true
|
@@ -12,7 +11,7 @@ module NewRelic
|
|
12
11
|
return if transaction.ignore?
|
13
12
|
|
14
13
|
tracer = ::NewRelic::Agent.agent.infinite_tracer
|
15
|
-
tracer <<
|
14
|
+
tracer << proc { SpanEventPrimitive.for_datastore_segment(self) }
|
16
15
|
end
|
17
16
|
end
|
18
17
|
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
# encoding: utf-8
|
2
1
|
# This file is distributed under New Relic's license terms.
|
3
2
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
3
|
# frozen_string_literal: true
|
@@ -12,7 +11,7 @@ module NewRelic
|
|
12
11
|
return if transaction.ignore?
|
13
12
|
|
14
13
|
tracer = ::NewRelic::Agent.agent.infinite_tracer
|
15
|
-
tracer <<
|
14
|
+
tracer << proc { SpanEventPrimitive.for_external_request_segment(self) }
|
16
15
|
end
|
17
16
|
end
|
18
17
|
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
# encoding: utf-8
|
2
1
|
# This file is distributed under New Relic's license terms.
|
3
2
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
3
|
# frozen_string_literal: true
|
@@ -16,7 +15,7 @@ module NewRelic
|
|
16
15
|
return if transaction.ignore?
|
17
16
|
|
18
17
|
tracer = ::NewRelic::Agent.agent.infinite_tracer
|
19
|
-
tracer <<
|
18
|
+
tracer << proc { SpanEventPrimitive.for_segment(self) }
|
20
19
|
end
|
21
20
|
end
|
22
21
|
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
# encoding: utf-8
|
2
1
|
# This file is distributed under New Relic's license terms.
|
3
2
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
3
|
# frozen_string_literal: true
|
@@ -6,13 +5,17 @@
|
|
6
5
|
module NewRelic::Agent
|
7
6
|
module InfiniteTracing
|
8
7
|
class Channel
|
8
|
+
COMPRESSION_LEVELS = %i[none low medium high].freeze
|
9
|
+
DEFAULT_COMPRESSION_LEVEL = :none
|
10
|
+
|
9
11
|
def stub
|
10
12
|
NewRelic::Agent.logger.debug("Infinite Tracer Opening Channel to #{host_and_port}")
|
11
13
|
|
12
14
|
Com::Newrelic::Trace::V1::IngestService::Stub.new( \
|
13
15
|
host_and_port,
|
14
16
|
credentials,
|
15
|
-
channel_override: channel
|
17
|
+
channel_override: channel,
|
18
|
+
channel_args: channel_args
|
16
19
|
)
|
17
20
|
end
|
18
21
|
|
@@ -20,6 +23,37 @@ module NewRelic::Agent
|
|
20
23
|
GRPC::Core::Channel.new(host_and_port, settings, credentials)
|
21
24
|
end
|
22
25
|
|
26
|
+
def channel_args
|
27
|
+
return NewRelic::EMPTY_HASH unless compression_enabled?
|
28
|
+
|
29
|
+
GRPC::Core::CompressionOptions.new(compression_options).to_channel_arg_hash
|
30
|
+
end
|
31
|
+
|
32
|
+
def compression_enabled?
|
33
|
+
compression_level != :none
|
34
|
+
end
|
35
|
+
|
36
|
+
def compression_level
|
37
|
+
@compression_level ||= begin
|
38
|
+
level = if valid_compression_level?(configured_compression_level)
|
39
|
+
configured_compression_level
|
40
|
+
else
|
41
|
+
DEFAULT_COMPRESSION_LEVEL
|
42
|
+
end
|
43
|
+
NewRelic::Agent.logger.debug("Infinite Tracer compression level set to #{level}")
|
44
|
+
level
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def compression_options
|
49
|
+
{default_algorithm: :gzip,
|
50
|
+
default_level: compression_level}
|
51
|
+
end
|
52
|
+
|
53
|
+
def configured_compression_level
|
54
|
+
NewRelic::Agent.config[:'infinite_tracing.compression_level']
|
55
|
+
end
|
56
|
+
|
23
57
|
def credentials
|
24
58
|
# Uses system configured certificates by default
|
25
59
|
GRPC::Core::ChannelCredentials.new
|
@@ -35,6 +69,15 @@ module NewRelic::Agent
|
|
35
69
|
'grpc.enable_deadline_checking' => 0
|
36
70
|
}
|
37
71
|
end
|
72
|
+
|
73
|
+
def valid_compression_level?(level)
|
74
|
+
return true if COMPRESSION_LEVELS.include?(level)
|
75
|
+
|
76
|
+
NewRelic::Agent.logger.error("Invalid compression level '#{level}' specified! Must be one of " \
|
77
|
+
"#{COMPRESSION_LEVELS.join('|')}. Using default level of '#{DEFAULT_COMPRESSION_LEVEL}'")
|
78
|
+
|
79
|
+
false
|
80
|
+
end
|
38
81
|
end
|
39
82
|
end
|
40
83
|
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
# encoding: utf-8
|
2
1
|
# This file is distributed under New Relic's license terms.
|
3
2
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
3
|
# frozen_string_literal: true
|
@@ -26,10 +25,15 @@ module NewRelic::Agent
|
|
26
25
|
buffer << segment
|
27
26
|
end
|
28
27
|
|
28
|
+
def batching_enabled?
|
29
|
+
NewRelic::Agent.config[:'infinite_tracing.batching']
|
30
|
+
end
|
31
|
+
|
29
32
|
# Transfers spans in streaming buffer from previous
|
30
33
|
# client (if any) and returns self (so we chain the call)
|
31
34
|
def transfer(previous_client)
|
32
35
|
return self unless previous_client
|
36
|
+
|
33
37
|
previous_client.buffer.transfer(buffer)
|
34
38
|
self
|
35
39
|
end
|
@@ -105,6 +109,7 @@ module NewRelic::Agent
|
|
105
109
|
# The Suspended Streaming Buffer will be installed in this state.
|
106
110
|
def suspend
|
107
111
|
return if suspended?
|
112
|
+
|
108
113
|
@lock.synchronize do
|
109
114
|
@suspended = true
|
110
115
|
@buffer = new_streaming_buffer
|
@@ -135,6 +140,7 @@ module NewRelic::Agent
|
|
135
140
|
|
136
141
|
def stop
|
137
142
|
return unless @response_handler
|
143
|
+
|
138
144
|
@lock.synchronize do
|
139
145
|
@response_handler.stop
|
140
146
|
@response_handler = nil
|
@@ -143,8 +149,9 @@ module NewRelic::Agent
|
|
143
149
|
|
144
150
|
def start_streaming(exponential_backoff = true)
|
145
151
|
return if suspended?
|
152
|
+
|
146
153
|
Connection.instance.wait_for_agent_connect
|
147
|
-
@lock.synchronize {
|
154
|
+
@lock.synchronize { response_handler(exponential_backoff) }
|
148
155
|
end
|
149
156
|
|
150
157
|
def record_spans(exponential_backoff)
|
@@ -154,6 +161,10 @@ module NewRelic::Agent
|
|
154
161
|
def record_span_batches(exponential_backoff)
|
155
162
|
RecordStatusHandler.new(self, Connection.record_span_batches(self, buffer.batch_enumerator, exponential_backoff))
|
156
163
|
end
|
164
|
+
|
165
|
+
def response_handler(backoff)
|
166
|
+
@response_handler = batching_enabled? ? record_span_batches(backoff) : record_spans(backoff)
|
167
|
+
end
|
157
168
|
end
|
158
169
|
end
|
159
170
|
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
# encoding: utf-8
|
2
1
|
# This file is distributed under New Relic's license terms.
|
3
2
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
3
|
# frozen_string_literal: true
|
@@ -59,7 +58,7 @@ module NewRelic::Agent
|
|
59
58
|
# If the port is declared on the host entry, it overrides the port entry because otherwise
|
60
59
|
# we'd need to figure out if user supplied the port or if the default source config set
|
61
60
|
# the port. To help with debugging configuration issues, we log whenever the port entry
|
62
|
-
# is
|
61
|
+
# is overridden by the presence of the port on the host entry.
|
63
62
|
def port_from_host_entry
|
64
63
|
port_str = NewRelic::Agent.config[:'infinite_tracing.trace_observer.host'].scan(%r{:(\d+)$}).flatten
|
65
64
|
if port = (port_str[0] and port_str[0].to_i)
|
@@ -75,7 +74,7 @@ module NewRelic::Agent
|
|
75
74
|
end
|
76
75
|
|
77
76
|
# The scheme is based on whether the Trace Observer is running locally or remotely.
|
78
|
-
# Remote unsecure (
|
77
|
+
# Remote unsecure (unencrypted) streaming is disallowed!
|
79
78
|
def trace_observer_scheme
|
80
79
|
local? ? NewRelic::HTTP : NewRelic::HTTPS
|
81
80
|
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
# encoding: utf-8
|
2
1
|
# This file is distributed under New Relic's license terms.
|
3
2
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
3
|
# frozen_string_literal: true
|
@@ -52,7 +51,7 @@ module NewRelic::Agent
|
|
52
51
|
# so we're able to signal the client to restart when connectivity to the
|
53
52
|
# server is disrupted.
|
54
53
|
def record_span_batches(client, enumerator, exponential_backoff)
|
55
|
-
instance.
|
54
|
+
instance.record_span_batches(client, enumerator, exponential_backoff)
|
56
55
|
end
|
57
56
|
|
58
57
|
def metadata
|
@@ -155,7 +154,7 @@ module NewRelic::Agent
|
|
155
154
|
rescue => exception
|
156
155
|
retry_connection_period = retry_connection_period(exponential_backoff)
|
157
156
|
::NewRelic::Agent.logger.error("Error establishing connection with infinite tracing service:", exception)
|
158
|
-
::NewRelic::Agent.logger.info("Will re-attempt
|
157
|
+
::NewRelic::Agent.logger.info("Will re-attempt infinite tracing connection in #{retry_connection_period} seconds")
|
159
158
|
sleep(retry_connection_period)
|
160
159
|
note_connect_failure
|
161
160
|
retry
|
@@ -1,4 +1,3 @@
|
|
1
|
-
# encoding: utf-8
|
2
1
|
# This file is distributed under New Relic's license terms.
|
3
2
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
3
|
# frozen_string_literal: true
|
@@ -6,7 +5,6 @@
|
|
6
5
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
7
6
|
# Source: infinite_tracing.proto for package 'com.newrelic.trace.v1'
|
8
7
|
# Original file comments:
|
9
|
-
# encoding: utf-8
|
10
8
|
# This file is distributed under New Relic's license terms.
|
11
9
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
12
10
|
#
|
@@ -1,4 +1,3 @@
|
|
1
|
-
# encoding: utf-8
|
2
1
|
# This file is distributed under New Relic's license terms.
|
3
2
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
3
|
# frozen_string_literal: true
|
@@ -18,34 +17,40 @@ module NewRelic::Agent
|
|
18
17
|
@messages_seen ? @messages_seen.messages_seen : 0
|
19
18
|
end
|
20
19
|
|
21
|
-
def start_handler
|
22
|
-
Worker.new(self.class.name) do
|
23
|
-
begin
|
24
|
-
@enumerator.each do |response|
|
25
|
-
break if response.nil? || response.is_a?(Exception)
|
26
|
-
@lock.synchronize do
|
27
|
-
@messages_seen = response
|
28
|
-
NewRelic::Agent.logger.debug("gRPC Infinite Tracer Observer saw #{messages_seen} messages")
|
29
|
-
end
|
30
|
-
end
|
31
|
-
NewRelic::Agent.logger.debug("gRPC Infinite Tracer Observer closed the stream")
|
32
|
-
@client.handle_close
|
33
|
-
rescue => error
|
34
|
-
@client.handle_error(error)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
rescue => error
|
38
|
-
NewRelic::Agent.logger.error("gRPC Worker Error", error)
|
39
|
-
end
|
40
|
-
|
41
20
|
def stop
|
42
21
|
return if @worker.nil?
|
22
|
+
|
43
23
|
@lock.synchronize do
|
44
24
|
NewRelic::Agent.logger.debug("gRPC Stopping Response Handler")
|
45
25
|
@worker.stop
|
46
26
|
@worker = nil
|
47
27
|
end
|
48
28
|
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def handle_response
|
33
|
+
@enumerator.each do |response|
|
34
|
+
break if response.nil? || response.is_a?(Exception)
|
35
|
+
|
36
|
+
@lock.synchronize do
|
37
|
+
@messages_seen = response
|
38
|
+
NewRelic::Agent.logger.debug("gRPC Infinite Tracer Observer saw #{messages_seen} messages")
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def start_handler
|
44
|
+
Worker.new(self.class.name) do
|
45
|
+
handle_response
|
46
|
+
NewRelic::Agent.logger.debug("gRPC Infinite Tracer Observer closed the stream")
|
47
|
+
@client.handle_close
|
48
|
+
rescue => error
|
49
|
+
@client.handle_error(error)
|
50
|
+
end
|
51
|
+
rescue => error
|
52
|
+
NewRelic::Agent.logger.error("gRPC Worker Error", error)
|
53
|
+
end
|
49
54
|
end
|
50
55
|
end
|
51
56
|
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
# encoding: utf-8
|
2
1
|
# This file is distributed under New Relic's license terms.
|
3
2
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
3
|
# frozen_string_literal: true
|
@@ -18,6 +17,10 @@ module NewRelic::Agent
|
|
18
17
|
DEFAULT_QUEUE_SIZE = 10_000
|
19
18
|
FLUSH_DELAY = 0.005
|
20
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
|
21
24
|
|
22
25
|
attr_reader :queue
|
23
26
|
|
@@ -92,6 +95,7 @@ module NewRelic::Agent
|
|
92
95
|
# application thread.
|
93
96
|
def enumerator
|
94
97
|
return enum_for(:enumerator) unless block_given?
|
98
|
+
|
95
99
|
loop do
|
96
100
|
if segment = @queue.pop(false)
|
97
101
|
NewRelic::Agent.increment_metric(SPANS_SENT_METRIC)
|
@@ -117,13 +121,16 @@ module NewRelic::Agent
|
|
117
121
|
# the gRPC call's thread rather than in the main
|
118
122
|
# application thread.
|
119
123
|
def batch_enumerator
|
120
|
-
return enum_for(:
|
124
|
+
return enum_for(:batch_enumerator) unless block_given?
|
125
|
+
|
126
|
+
last_time = Process.clock_gettime(Process::CLOCK_REALTIME)
|
121
127
|
loop do
|
122
128
|
if proc_or_segment = @queue.pop(false)
|
123
129
|
NewRelic::Agent.increment_metric(SPANS_SENT_METRIC)
|
124
130
|
@batch << transform(proc_or_segment)
|
125
|
-
if
|
131
|
+
if batch_ready?(last_time)
|
126
132
|
yield(SpanBatch.new(spans: @batch))
|
133
|
+
last_time = Process.clock_gettime(Process::CLOCK_REALTIME)
|
127
134
|
@batch.clear
|
128
135
|
end
|
129
136
|
|
@@ -136,6 +143,10 @@ module NewRelic::Agent
|
|
136
143
|
|
137
144
|
private
|
138
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
|
+
|
139
150
|
def span_event(proc_or_segment)
|
140
151
|
if proc_or_segment.is_a?(Proc)
|
141
152
|
proc_or_segment.call
|
@@ -1,4 +1,3 @@
|
|
1
|
-
# encoding: utf-8
|
2
1
|
# This file is distributed under New Relic's license terms.
|
3
2
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
3
|
# frozen_string_literal: true
|
@@ -23,8 +22,10 @@ module NewRelic::Agent
|
|
23
22
|
|
24
23
|
def status
|
25
24
|
return "error" if error?
|
25
|
+
|
26
26
|
@lock.synchronize do
|
27
27
|
return "stopped" if @worker_thread.nil?
|
28
|
+
|
28
29
|
@worker_thread.status || "idle"
|
29
30
|
end
|
30
31
|
end
|
@@ -35,6 +36,7 @@ module NewRelic::Agent
|
|
35
36
|
|
36
37
|
def join(timeout = nil)
|
37
38
|
return unless @worker_thread
|
39
|
+
|
38
40
|
NewRelic::Agent.logger.debug("joining worker #{@name} thread...")
|
39
41
|
@worker_thread.join(timeout)
|
40
42
|
end
|
@@ -42,6 +44,7 @@ module NewRelic::Agent
|
|
42
44
|
def stop
|
43
45
|
@lock.synchronize do
|
44
46
|
return unless @worker_thread
|
47
|
+
|
45
48
|
NewRelic::Agent.logger.debug("stopping worker #{@name} thread...")
|
46
49
|
@worker_thread.kill
|
47
50
|
@worker_thread = nil
|
data/lib/infinite_tracing.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
// encoding: utf-8
|
2
1
|
// This file is distributed under New Relic's license terms.
|
3
2
|
// See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
3
|
|
@@ -39,4 +38,4 @@ message AttributeValue {
|
|
39
38
|
|
40
39
|
message RecordStatus {
|
41
40
|
uint64 messages_seen = 1;
|
42
|
-
}
|
41
|
+
}
|
@@ -1,4 +1,3 @@
|
|
1
|
-
#-*- coding: utf-8 -*-
|
2
1
|
# frozen_string_literal: true
|
3
2
|
|
4
3
|
require 'fileutils'
|
@@ -69,7 +68,7 @@ Gem or plugin, hosted on https://github.com/newrelic/newrelic-ruby-agent/
|
|
69
68
|
s.files = file_list
|
70
69
|
|
71
70
|
s.homepage = "https://github.com/newrelic/newrelic-ruby-agent/tree/main/infinite_tracing"
|
72
|
-
s.require_paths = [
|
71
|
+
s.require_paths = %w[lib infinite_tracing]
|
73
72
|
s.summary = "New Relic Infinite Tracing for the Ruby agent"
|
74
73
|
|
75
74
|
s.add_dependency 'newrelic_rpm', NewRelic::VERSION::STRING
|
@@ -78,7 +77,8 @@ Gem or plugin, hosted on https://github.com/newrelic/newrelic-ruby-agent/
|
|
78
77
|
s.add_development_dependency 'rake', '12.3.3'
|
79
78
|
s.add_development_dependency 'rb-inotify', '0.9.10' # locked to support < Ruby 2.3 (and listen 3.0.8)
|
80
79
|
s.add_development_dependency 'listen', '3.0.8' # locked to support < Ruby 2.3
|
81
|
-
s.add_development_dependency 'minitest', '~> 5.
|
80
|
+
s.add_development_dependency 'minitest', '~> 5.15'
|
81
|
+
s.add_development_dependency 'minitest-stub-const', '0.6'
|
82
82
|
s.add_development_dependency 'mocha', '~> 1.9.0'
|
83
83
|
s.add_development_dependency 'pry-nav', '~> 0.3.0'
|
84
84
|
s.add_development_dependency 'pry-stack_explorer', '~> 0.4.9'
|
data/tasks/all.rb
CHANGED
@@ -0,0 +1,25 @@
|
|
1
|
+
# This file is distributed under New Relic's license terms.
|
2
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
3
|
+
# frozen_string_literal: true
|
4
|
+
|
5
|
+
module License
|
6
|
+
def extract_license_terms(file_contents)
|
7
|
+
text = []
|
8
|
+
text << file_contents.shift while !file_contents.empty? && file_contents[0] =~ /^#/
|
9
|
+
text << ""
|
10
|
+
text
|
11
|
+
end
|
12
|
+
|
13
|
+
def add_license_preamble_and_remove_requires(output_path)
|
14
|
+
gemspec_path = File.expand_path(File.join(output_path, '..', '..', '..', '..', '..'))
|
15
|
+
license_terms = extract_license_terms(File.readlines(File.join(gemspec_path, "Gemfile")))
|
16
|
+
Dir.glob(File.join(output_path, "*.rb")) do |filename|
|
17
|
+
contents = File.readlines(filename)
|
18
|
+
contents.reject! { |r| r =~ /^\s*require\s.*$/ }
|
19
|
+
File.open(filename, 'w') do |output|
|
20
|
+
output.puts license_terms
|
21
|
+
output.puts contents
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/tasks/proto.rake
CHANGED
@@ -1,34 +1,13 @@
|
|
1
|
-
# encoding: utf-8
|
2
1
|
# This file is distributed under New Relic's license terms.
|
3
2
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
3
|
# frozen_string_literal: true
|
5
4
|
|
5
|
+
require_relative 'helpers/license'
|
6
|
+
include License
|
7
|
+
|
6
8
|
namespace :proto do
|
7
9
|
desc "Generate proto files"
|
8
|
-
|
9
10
|
task :generate do
|
10
|
-
def extract_license_terms(file_contents)
|
11
|
-
text = []
|
12
|
-
text << file_contents.shift while !file_contents.empty? && file_contents[0] =~ /^#/
|
13
|
-
text << ""
|
14
|
-
text
|
15
|
-
end
|
16
|
-
|
17
|
-
# adds the NewRelic License notice to the top of the generated files
|
18
|
-
# Removes require lines since these are replicated in the proto.rb file.
|
19
|
-
def add_license_preamble_and_remove_requires(output_path)
|
20
|
-
gemspec_path = File.expand_path(File.join(output_path, '..', '..', '..', '..', '..'))
|
21
|
-
license_terms = extract_license_terms(File.readlines(File.join(gemspec_path, "Gemfile")))
|
22
|
-
Dir.glob(File.join(output_path, "*.rb")) do |filename|
|
23
|
-
contents = File.readlines(filename)
|
24
|
-
contents.reject! { |r| r =~ /^\s*require\s.*$/ }
|
25
|
-
File.open(filename, 'w') do |output|
|
26
|
-
output.puts license_terms
|
27
|
-
output.puts contents
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
11
|
gem_folder = File.expand_path(File.join(File.dirname(__FILE__), ".."))
|
33
12
|
proto_filename = File.join(gem_folder, "lib", "new_relic", "proto", "infinite_tracing.proto")
|
34
13
|
output_path = File.join(gem_folder, "lib", "new_relic", "infinite_tracing", "proto")
|
@@ -43,7 +22,7 @@ namespace :proto do
|
|
43
22
|
|
44
23
|
if system(cmd)
|
45
24
|
puts "Proto file generated!"
|
46
|
-
add_license_preamble_and_remove_requires
|
25
|
+
add_license_preamble_and_remove_requires(output_path)
|
47
26
|
else
|
48
27
|
puts "Failed to generate proto file."
|
49
28
|
end
|
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-
|
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
|
@@ -89,14 +89,28 @@ dependencies:
|
|
89
89
|
requirements:
|
90
90
|
- - "~>"
|
91
91
|
- !ruby/object:Gem::Version
|
92
|
-
version: 5.
|
92
|
+
version: '5.15'
|
93
93
|
type: :development
|
94
94
|
prerelease: false
|
95
95
|
version_requirements: !ruby/object:Gem::Requirement
|
96
96
|
requirements:
|
97
97
|
- - "~>"
|
98
98
|
- !ruby/object:Gem::Version
|
99
|
-
version: 5.
|
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
|
@@ -259,6 +273,7 @@ files:
|
|
259
273
|
- lib/proto/infinite_tracing.proto
|
260
274
|
- newrelic-infinite_tracing.gemspec
|
261
275
|
- tasks/all.rb
|
276
|
+
- tasks/helpers/license.rb
|
262
277
|
- tasks/proto.rake
|
263
278
|
homepage: https://github.com/newrelic/newrelic-ruby-agent/tree/main/infinite_tracing
|
264
279
|
licenses:
|