newrelic_rpm 4.8.0.341 → 5.1.0.344
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +27 -0
- data/CHANGELOG.md +93 -0
- data/README.md +0 -3
- data/config.dot +0 -3
- data/lib/new_relic/agent/{throughput_monitor.rb → adaptive_sampler.rb} +22 -13
- data/lib/new_relic/agent/agent.rb +3 -4
- data/lib/new_relic/agent/configuration/default_source.rb +41 -19
- data/lib/new_relic/agent/configuration/high_security_source.rb +0 -2
- data/lib/new_relic/agent/database/explain_plan_helpers.rb +11 -0
- data/lib/new_relic/agent/database.rb +5 -0
- data/lib/new_relic/agent/distributed_trace_monitor.rb +4 -2
- data/lib/new_relic/agent/distributed_trace_payload.rb +85 -119
- data/lib/new_relic/agent/error_collector.rb +17 -1
- data/lib/new_relic/agent/external.rb +14 -0
- data/lib/new_relic/agent/heap.rb +140 -0
- data/lib/new_relic/agent/instrumentation/active_record_5.rb +5 -0
- data/lib/new_relic/agent/instrumentation/active_record_prepend.rb +14 -1
- data/lib/new_relic/agent/instrumentation/bunny.rb +5 -1
- data/lib/new_relic/agent/instrumentation/grape.rb +33 -29
- data/lib/new_relic/agent/instrumentation/rails5/action_cable.rb +5 -1
- data/lib/new_relic/agent/instrumentation/resque.rb +17 -36
- data/lib/new_relic/agent/instrumentation/sequel.rb +0 -1
- data/lib/new_relic/agent/javascript_instrumentor.rb +2 -2
- data/lib/new_relic/agent/messaging.rb +10 -0
- data/lib/new_relic/agent/method_tracer.rb +23 -18
- data/lib/new_relic/agent/new_relic_service.rb +43 -23
- data/lib/new_relic/agent/priority_sampled_buffer.rb +68 -0
- data/lib/new_relic/agent/supported_versions.rb +1 -1
- data/lib/new_relic/agent/transaction/attributes.rb +1 -0
- data/lib/new_relic/agent/transaction/distributed_tracing.rb +173 -55
- data/lib/new_relic/agent/transaction/external_request_segment.rb +14 -64
- data/lib/new_relic/agent/transaction/message_broker_segment.rb +12 -4
- data/lib/new_relic/agent/transaction.rb +15 -8
- data/lib/new_relic/agent/transaction_error_primitive.rb +2 -8
- data/lib/new_relic/agent/transaction_event_aggregator.rb +16 -13
- data/lib/new_relic/agent/transaction_event_primitive.rb +5 -3
- data/lib/new_relic/agent/transaction_event_recorder.rb +3 -11
- data/lib/new_relic/agent.rb +27 -0
- data/lib/new_relic/build.rb +2 -2
- data/lib/new_relic/recipes/capistrano3.rb +5 -2
- data/lib/new_relic/version.rb +2 -2
- data/newrelic_rpm.gemspec +3 -2
- metadata +39 -9
- data/lib/new_relic/agent/distributed_trace_priority_sampled_buffer.rb +0 -72
@@ -50,14 +50,9 @@ module NewRelic
|
|
50
50
|
synthetics_header = transaction && transaction.raw_synthetics_header
|
51
51
|
insert_synthetics_header request, synthetics_header if synthetics_header
|
52
52
|
|
53
|
-
return unless record_metrics?
|
54
|
-
|
55
|
-
transaction_state.is_cross_app_caller = true
|
56
|
-
txn_guid = transaction_state.request_guid
|
57
|
-
trip_id = transaction && transaction.cat_trip_id
|
58
|
-
path_hash = transaction && transaction.cat_path_hash
|
53
|
+
return unless record_metrics?
|
59
54
|
|
60
|
-
|
55
|
+
insert_cross_app_header request
|
61
56
|
insert_distributed_trace_header request
|
62
57
|
rescue => e
|
63
58
|
NewRelic::Agent.logger.error "Error in add_request_headers", e
|
@@ -181,7 +176,6 @@ module NewRelic
|
|
181
176
|
|
182
177
|
def record_metrics
|
183
178
|
add_unscoped_metrics
|
184
|
-
record_distributed_tracing_metrics if Agent.config[:'distributed_tracing.enabled']
|
185
179
|
super
|
186
180
|
end
|
187
181
|
|
@@ -206,11 +200,22 @@ module NewRelic
|
|
206
200
|
end
|
207
201
|
end
|
208
202
|
|
203
|
+
def insert_cross_app_header request
|
204
|
+
return unless CrossAppTracing.cross_app_enabled?
|
205
|
+
|
206
|
+
transaction_state.is_cross_app_caller = true
|
207
|
+
txn_guid = transaction_state.request_guid
|
208
|
+
trip_id = transaction && transaction.cat_trip_id
|
209
|
+
path_hash = transaction && transaction.cat_path_hash
|
210
|
+
|
211
|
+
CrossAppTracing.insert_request_headers request, txn_guid, trip_id, path_hash
|
212
|
+
end
|
213
|
+
|
209
214
|
X_NEWRELIC_TRACE_HEADER = "X-NewRelic-Trace".freeze
|
210
215
|
|
211
216
|
def insert_distributed_trace_header request
|
212
217
|
return unless Agent.config[:'distributed_tracing.enabled']
|
213
|
-
payload = transaction.create_distributed_trace_payload
|
218
|
+
payload = transaction.create_distributed_trace_payload
|
214
219
|
request[X_NEWRELIC_TRACE_HEADER] = payload.http_safe
|
215
220
|
end
|
216
221
|
|
@@ -238,61 +243,6 @@ module NewRelic
|
|
238
243
|
end
|
239
244
|
end
|
240
245
|
|
241
|
-
ALL_SUFFIX = "all".freeze
|
242
|
-
ALL_WEB_SUFFIX = "allWeb".freeze
|
243
|
-
ALL_OTHER_SUFFIX = "allOther".freeze
|
244
|
-
|
245
|
-
def transaction_type_suffix
|
246
|
-
if Transaction.recording_web_transaction?
|
247
|
-
ALL_WEB_SUFFIX
|
248
|
-
else
|
249
|
-
ALL_OTHER_SUFFIX
|
250
|
-
end
|
251
|
-
end
|
252
|
-
|
253
|
-
def record_distributed_tracing_metrics
|
254
|
-
add_caller_by_duration_metrics
|
255
|
-
record_transport_duration_metrics
|
256
|
-
record_errors_by_caller_metrics
|
257
|
-
end
|
258
|
-
|
259
|
-
DURATION_BY_CALLER_UNKOWN_PREFIX = "DurationByCaller/Unknown/Unknown/Unknown/Unknown".freeze
|
260
|
-
|
261
|
-
def add_caller_by_duration_metrics
|
262
|
-
prefix = if transaction.distributed_trace?
|
263
|
-
payload = transaction.distributed_trace_payload
|
264
|
-
"DurationByCaller/#{payload.caller_type}/#{payload.caller_account_id}/#{payload.caller_app_id}/transport"
|
265
|
-
else
|
266
|
-
DURATION_BY_CALLER_UNKOWN_PREFIX
|
267
|
-
end
|
268
|
-
|
269
|
-
@unscoped_metrics << "#{prefix}/#{ALL_SUFFIX}"
|
270
|
-
@unscoped_metrics << "#{prefix}/#{transaction_type_suffix}"
|
271
|
-
end
|
272
|
-
|
273
|
-
def record_transport_duration_metrics
|
274
|
-
return unless transaction.distributed_trace?
|
275
|
-
payload = transaction.distributed_trace_payload
|
276
|
-
prefix = "TransportDuration/#{payload.caller_type}/#{payload.caller_account_id}/#{payload.caller_app_id}/transport"
|
277
|
-
metric_cache.record_unscoped "#{prefix}/#{ALL_SUFFIX}", transaction.transport_duration
|
278
|
-
metric_cache.record_unscoped "#{prefix}/#{transaction_type_suffix}", transaction.transport_duration
|
279
|
-
end
|
280
|
-
|
281
|
-
ERRORS_BY_CALLER_UNKOWN_PREFIX = "ErrorsByCaller/Unknown/Unknown/Unknown/Unknown".freeze
|
282
|
-
|
283
|
-
def record_errors_by_caller_metrics
|
284
|
-
return unless transaction.exceptions.size > 0
|
285
|
-
prefix = if transaction.distributed_trace?
|
286
|
-
payload = transaction.distributed_trace_payload
|
287
|
-
"ErrorsByCaller/#{payload.caller_type}/#{payload.caller_account_id}/#{payload.caller_app_id}/transport"
|
288
|
-
else
|
289
|
-
ERRORS_BY_CALLER_UNKOWN_PREFIX
|
290
|
-
end
|
291
|
-
|
292
|
-
NewRelic::Agent.increment_metric "#{prefix}/#{ALL_SUFFIX}"
|
293
|
-
NewRelic::Agent.increment_metric "#{prefix}/#{transaction_type_suffix}"
|
294
|
-
end
|
295
|
-
|
296
246
|
def update_segment_name
|
297
247
|
if @app_data
|
298
248
|
@name = "ExternalTransaction/#{host}/#{cross_process_id}/#{cross_process_transaction_name}"
|
@@ -83,21 +83,29 @@ module NewRelic
|
|
83
83
|
if destination_type == :temporary_queue || destination_type == :temporary_topic
|
84
84
|
@name << TEMP
|
85
85
|
else
|
86
|
-
@name << NAMED << destination_name
|
86
|
+
@name << NAMED << destination_name.to_s
|
87
87
|
end
|
88
88
|
|
89
89
|
@name
|
90
90
|
end
|
91
91
|
|
92
|
+
NEWRELIC_TRACE_KEY = "NewRelicTrace".freeze
|
93
|
+
|
94
|
+
def insert_distributed_trace_header
|
95
|
+
return unless Agent.config[:'distributed_tracing.enabled']
|
96
|
+
payload = transaction.create_distributed_trace_payload
|
97
|
+
headers[NEWRELIC_TRACE_KEY] = payload.http_safe
|
98
|
+
end
|
99
|
+
|
92
100
|
def transaction= t
|
93
101
|
super
|
94
|
-
if headers && transaction && action == :produce && record_metrics?
|
95
|
-
|
102
|
+
if headers && transaction && action == :produce && record_metrics?
|
103
|
+
insert_distributed_trace_header
|
104
|
+
transaction.add_message_cat_headers headers if CrossAppTracing.cross_app_enabled?
|
96
105
|
end
|
97
106
|
rescue => e
|
98
107
|
NewRelic::Agent.logger.error "Error during message header processing", e
|
99
108
|
end
|
100
|
-
|
101
109
|
end
|
102
110
|
end
|
103
111
|
end
|
@@ -58,7 +58,8 @@ module NewRelic
|
|
58
58
|
:http_response_code,
|
59
59
|
:response_content_length,
|
60
60
|
:response_content_type,
|
61
|
-
:sampled
|
61
|
+
:sampled,
|
62
|
+
:priority
|
62
63
|
|
63
64
|
attr_reader :guid,
|
64
65
|
:metrics,
|
@@ -283,11 +284,15 @@ module NewRelic
|
|
283
284
|
@ignore_trace = false
|
284
285
|
|
285
286
|
if Agent.config[:'distributed_tracing.enabled']
|
286
|
-
@sampled = NewRelic::Agent.instance.
|
287
|
+
@sampled = NewRelic::Agent.instance.adaptive_sampler.sampled?
|
287
288
|
else
|
288
289
|
@sampled = nil
|
289
290
|
end
|
290
291
|
|
292
|
+
# we will eventually add this behavior into the AdaptiveSampler (ThroughputMontor)
|
293
|
+
@priority = rand
|
294
|
+
@priority +=1 if @sampled
|
295
|
+
|
291
296
|
@attributes = Attributes.new(NewRelic::Agent.instance.attribute_filter)
|
292
297
|
|
293
298
|
merge_request_parameters(@filtered_params)
|
@@ -561,6 +566,7 @@ module NewRelic
|
|
561
566
|
record_apdex(state, end_time) unless ignore_apdex?
|
562
567
|
record_queue_time
|
563
568
|
record_client_application_metric state
|
569
|
+
record_distributed_tracing_metrics
|
564
570
|
|
565
571
|
record_exceptions
|
566
572
|
record_transaction_event
|
@@ -596,7 +602,7 @@ module NewRelic
|
|
596
602
|
end
|
597
603
|
|
598
604
|
def assign_intrinsics(state)
|
599
|
-
attributes.add_intrinsic_attribute :'
|
605
|
+
attributes.add_intrinsic_attribute :'sampled', sampled?
|
600
606
|
|
601
607
|
if gc_time = calculate_gc_time
|
602
608
|
attributes.add_intrinsic_attribute(:gc_time, gc_time)
|
@@ -612,8 +618,8 @@ module NewRelic
|
|
612
618
|
attributes.add_intrinsic_attribute(:synthetics_monitor_id, synthetics_monitor_id)
|
613
619
|
end
|
614
620
|
|
615
|
-
if distributed_trace_payload ||
|
616
|
-
|
621
|
+
if distributed_trace_payload || distributed_trace_payload_created?
|
622
|
+
assign_distributed_trace_intrinsics
|
617
623
|
elsif state.is_cross_app?
|
618
624
|
attributes.add_intrinsic_attribute(:trip_id, cat_trip_id)
|
619
625
|
attributes.add_intrinsic_attribute(:path_hash, cat_path_hash)
|
@@ -648,13 +654,14 @@ module NewRelic
|
|
648
654
|
:duration => duration,
|
649
655
|
:metrics => @metrics,
|
650
656
|
:attributes => @attributes,
|
651
|
-
:error => false
|
657
|
+
:error => false,
|
658
|
+
:priority => @priority
|
652
659
|
}
|
653
660
|
|
654
|
-
@payload[:'
|
661
|
+
@payload[:'sampled'] = sampled? if Agent.config[:'distributed_tracing.enabled']
|
655
662
|
|
656
663
|
append_cat_info(state, duration, @payload)
|
657
|
-
|
664
|
+
append_distributed_trace_info(@payload)
|
658
665
|
append_apdex_perf_zone(duration, @payload)
|
659
666
|
append_synthetics_to(state, @payload)
|
660
667
|
append_referring_transaction_guid_to(state, @payload)
|
@@ -24,7 +24,7 @@ module NewRelic
|
|
24
24
|
PORT_KEY = 'port'.freeze
|
25
25
|
NAME_KEY = 'transactionName'.freeze
|
26
26
|
DURATION_KEY = 'duration'.freeze
|
27
|
-
SAMPLED_KEY = '
|
27
|
+
SAMPLED_KEY = 'sampled'.freeze
|
28
28
|
GUID_KEY = 'nr.transactionGuid'.freeze
|
29
29
|
REFERRING_TRANSACTION_GUID_KEY = 'nr.referringTransactionGuid'.freeze
|
30
30
|
SYNTHETICS_RESOURCE_ID_KEY = "nr.syntheticsResourceId".freeze
|
@@ -53,7 +53,7 @@ module NewRelic
|
|
53
53
|
if payload
|
54
54
|
attrs[NAME_KEY] = payload[:name]
|
55
55
|
attrs[DURATION_KEY] = payload[:duration]
|
56
|
-
attrs[SAMPLED_KEY] = payload[:'
|
56
|
+
attrs[SAMPLED_KEY] = payload[:'sampled'] if Agent.config[:'distributed_tracing.enabled']
|
57
57
|
append_synthetics payload, attrs
|
58
58
|
append_cat payload, attrs
|
59
59
|
append_distributed_trace_intrinsics payload, attrs
|
@@ -74,18 +74,12 @@ module NewRelic
|
|
74
74
|
sample[REFERRING_TRANSACTION_GUID_KEY] = payload[:referring_transaction_guid] if payload[:referring_transaction_guid]
|
75
75
|
end
|
76
76
|
|
77
|
-
OTHER_GUID_KEY = "nr.guid".freeze
|
78
|
-
|
79
77
|
def append_distributed_trace_intrinsics payload, sample
|
80
78
|
return unless Agent.config[:'distributed_tracing.enabled']
|
81
79
|
DistributedTracePayload::INTRINSIC_KEYS.each do |key|
|
82
80
|
value = payload[key]
|
83
81
|
sample[key] = value unless value.nil?
|
84
82
|
end
|
85
|
-
# guid has a different name for transaction events
|
86
|
-
if sample.key? OTHER_GUID_KEY
|
87
|
-
sample[GUID_KEY] = sample.delete OTHER_GUID_KEY
|
88
|
-
end
|
89
83
|
end
|
90
84
|
end
|
91
85
|
end
|
@@ -6,7 +6,7 @@
|
|
6
6
|
require 'newrelic_rpm' unless defined?( NewRelic )
|
7
7
|
require 'new_relic/agent' unless defined?( NewRelic::Agent )
|
8
8
|
require 'new_relic/agent/event_aggregator'
|
9
|
-
require 'new_relic/agent/
|
9
|
+
require 'new_relic/agent/priority_sampled_buffer'
|
10
10
|
|
11
11
|
module NewRelic
|
12
12
|
module Agent
|
@@ -15,27 +15,30 @@ module NewRelic
|
|
15
15
|
named :TransactionEventAggregator
|
16
16
|
capacity_key :'analytics_events.max_samples_stored'
|
17
17
|
enabled_key :'analytics_events.enabled'
|
18
|
-
buffer_class
|
18
|
+
buffer_class PrioritySampledBuffer
|
19
|
+
|
20
|
+
def append priority: nil, event:nil, &blk
|
21
|
+
unless(event || priority && blk)
|
22
|
+
raise ArgumentError, "Expected priority and block, or event"
|
23
|
+
end
|
19
24
|
|
20
|
-
def append event=nil, &blk
|
21
|
-
raise ArgumentError, "Expected argument or block, but received both" if event && blk
|
22
25
|
return unless enabled?
|
23
26
|
|
24
27
|
@lock.synchronize do
|
25
|
-
@buffer.append event, &blk
|
28
|
+
@buffer.append priority: priority, event: event, &blk
|
26
29
|
notify_if_full
|
27
30
|
end
|
28
31
|
end
|
29
32
|
|
30
|
-
|
31
|
-
# the ones passed to append)
|
32
|
-
def append_sampled event=nil, &blk
|
33
|
-
raise ArgumentError, "Expected argument or block, but received both" if event && blk
|
34
|
-
return unless enabled?
|
35
|
-
|
33
|
+
def merge! payload, adjust_count = true
|
36
34
|
@lock.synchronize do
|
37
|
-
|
38
|
-
|
35
|
+
_, samples = payload
|
36
|
+
|
37
|
+
if adjust_count
|
38
|
+
@buffer.decrement_lifetime_counts_by samples.count
|
39
|
+
end
|
40
|
+
|
41
|
+
samples.each { |s| @buffer.append event: s }
|
39
42
|
end
|
40
43
|
end
|
41
44
|
|
@@ -25,7 +25,8 @@ module NewRelic
|
|
25
25
|
NAME_KEY = 'name'.freeze
|
26
26
|
DURATION_KEY = 'duration'.freeze
|
27
27
|
ERROR_KEY = 'error'.freeze
|
28
|
-
SAMPLED_KEY = '
|
28
|
+
SAMPLED_KEY = 'sampled'.freeze
|
29
|
+
PRIORITY_KEY = 'priority'.freeze
|
29
30
|
GUID_KEY = 'nr.guid'.freeze
|
30
31
|
REFERRING_TRANSACTION_GUID_KEY = 'nr.referringTransactionGuid'.freeze
|
31
32
|
CAT_TRIP_ID_KEY = 'nr.tripId'.freeze
|
@@ -47,10 +48,11 @@ module NewRelic
|
|
47
48
|
NAME_KEY => string(payload[:name]),
|
48
49
|
DURATION_KEY => float(payload[:duration]),
|
49
50
|
TYPE_KEY => SAMPLE_TYPE,
|
50
|
-
ERROR_KEY => payload[:error]
|
51
|
+
ERROR_KEY => payload[:error],
|
52
|
+
PRIORITY_KEY => payload[:priority]
|
51
53
|
}
|
52
54
|
|
53
|
-
intrinsics[SAMPLED_KEY] = payload[:'
|
55
|
+
intrinsics[SAMPLED_KEY] = payload[:'sampled'] if Agent.config[:'distributed_tracing.enabled']
|
54
56
|
|
55
57
|
NewRelic::Agent::PayloadMetricMapping.append_mapped_metrics(payload[:metrics], intrinsics)
|
56
58
|
append_optional_attributes(intrinsics, payload)
|
@@ -22,14 +22,12 @@ module NewRelic
|
|
22
22
|
def record payload
|
23
23
|
return unless NewRelic::Agent.config[:'analytics_events.enabled']
|
24
24
|
|
25
|
-
if
|
26
|
-
transaction_event_aggregator.append_sampled { create_event(payload) }
|
27
|
-
elsif synthetics_event? payload
|
25
|
+
if synthetics_event? payload
|
28
26
|
event = create_event payload
|
29
27
|
_, rejected = synthetics_event_aggregator.append_or_reject event
|
30
|
-
transaction_event_aggregator.append event if rejected
|
28
|
+
transaction_event_aggregator.append event: event if rejected
|
31
29
|
else
|
32
|
-
transaction_event_aggregator.append { create_event(payload) }
|
30
|
+
transaction_event_aggregator.append(priority: payload[:priority]) { create_event(payload) }
|
33
31
|
end
|
34
32
|
end
|
35
33
|
|
@@ -41,12 +39,6 @@ module NewRelic
|
|
41
39
|
payload.key? :synthetics_resource_id
|
42
40
|
end
|
43
41
|
|
44
|
-
SAMPLED_KEY = 'nr.sampled'
|
45
|
-
|
46
|
-
def sampled_event? payload
|
47
|
-
!!payload[SAMPLED_KEY]
|
48
|
-
end
|
49
|
-
|
50
42
|
def drop_buffered_data
|
51
43
|
transaction_event_aggregator.reset!
|
52
44
|
synthetics_event_aggregator.reset!
|
data/lib/new_relic/agent.rb
CHANGED
@@ -99,6 +99,8 @@ module NewRelic
|
|
99
99
|
|
100
100
|
@agent = nil
|
101
101
|
@logger = nil
|
102
|
+
@tracer_lock = Mutex.new
|
103
|
+
@tracer_queue = []
|
102
104
|
|
103
105
|
# The singleton Agent instance. Used internally.
|
104
106
|
def agent #:nodoc:
|
@@ -110,6 +112,7 @@ module NewRelic
|
|
110
112
|
|
111
113
|
def agent=(new_instance)#:nodoc:
|
112
114
|
@agent = new_instance
|
115
|
+
add_deferred_method_tracers_now
|
113
116
|
end
|
114
117
|
|
115
118
|
alias instance agent #:nodoc:
|
@@ -124,6 +127,30 @@ module NewRelic
|
|
124
127
|
@logger = log
|
125
128
|
end
|
126
129
|
|
130
|
+
# A third-party class may call add_method_tracer before the agent
|
131
|
+
# is initialized; these methods enable us to defer these calls
|
132
|
+
# until we have started up and can process them.
|
133
|
+
#
|
134
|
+
def add_or_defer_method_tracer(receiver, method_name, metric_name_code, options)
|
135
|
+
@tracer_lock.synchronize do
|
136
|
+
if @agent
|
137
|
+
receiver.send(:_add_method_tracer_now, method_name, metric_name_code, options)
|
138
|
+
else
|
139
|
+
@tracer_queue << [receiver, method_name, metric_name_code, options]
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
def add_deferred_method_tracers_now
|
145
|
+
@tracer_lock.synchronize do
|
146
|
+
@tracer_queue.each do |receiver, method_name, metric_name_code, options|
|
147
|
+
receiver.send(:_add_method_tracer_now, method_name, metric_name_code, options)
|
148
|
+
end
|
149
|
+
|
150
|
+
@tracer_queue = []
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
127
154
|
def config
|
128
155
|
@config ||= Configuration::Manager.new
|
129
156
|
end
|
data/lib/new_relic/build.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
# GITSHA:
|
2
|
-
module NewRelic; module VERSION; BUILD='
|
1
|
+
# GITSHA: f0bba48fa0d6af783f0891ab124c2188bb802145
|
2
|
+
module NewRelic; module VERSION; BUILD='344'; end; end
|
@@ -34,7 +34,10 @@ namespace :newrelic do
|
|
34
34
|
user = fetch(:newrelic_user)
|
35
35
|
license_key = fetch(:newrelic_license_key)
|
36
36
|
|
37
|
-
|
37
|
+
has_scm_from_plugin = respond_to?(:scm_plugin_installed?) && scm_plugin_installed?
|
38
|
+
has_scm_from_config = defined?(scm) && !scm.nil? && scm != :none
|
39
|
+
|
40
|
+
if has_scm_from_plugin || has_scm_from_config
|
38
41
|
changelog ||= lookup_changelog
|
39
42
|
rev ||= fetch(:current_revision)
|
40
43
|
end
|
@@ -69,7 +72,7 @@ namespace :newrelic do
|
|
69
72
|
|
70
73
|
debug "Retrieving changelog for New Relic Deployment details"
|
71
74
|
|
72
|
-
if
|
75
|
+
if Rake::Task.task_defined?("git:check")
|
73
76
|
log_command = "git --no-pager log --no-color --pretty=format:' * %an: %s' " +
|
74
77
|
"--abbrev-commit --no-merges #{previous_revision}..#{current_revision}"
|
75
78
|
`#{log_command}`
|
data/lib/new_relic/version.rb
CHANGED
data/newrelic_rpm.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.version = NewRelic::VERSION::STRING
|
11
11
|
s.required_ruby_version = '>= 2.0.0'
|
12
12
|
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
|
13
|
-
s.authors = [ "Matthew Wear", "Chris Pine", "
|
13
|
+
s.authors = [ "Matthew Wear", "Chris Pine", "Erin Dees", "Rachel Klein" ]
|
14
14
|
s.date = Time.now.strftime('%Y-%m-%d')
|
15
15
|
s.licenses = ['New Relic']
|
16
16
|
s.description = <<-EOS
|
@@ -47,7 +47,8 @@ EOS
|
|
47
47
|
s.add_development_dependency 'yard'
|
48
48
|
s.add_development_dependency 'rails', '~> 3.2.13'
|
49
49
|
s.add_development_dependency 'json', '>= 2.0.2' if RUBY_VERSION >= '2.4.0' # possible bundler issue?
|
50
|
-
s.add_development_dependency 'pry', '~> 0.
|
50
|
+
s.add_development_dependency 'pry-nav', '~> 0.2.4'
|
51
|
+
s.add_development_dependency 'pry-stack_explorer', '~> 0.4.9'
|
51
52
|
s.add_development_dependency 'hometown', '~> 0.2.5'
|
52
53
|
|
53
54
|
if RUBY_PLATFORM == 'java'
|
metadata
CHANGED
@@ -1,16 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: newrelic_rpm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 5.1.0.344
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Wear
|
8
8
|
- Chris Pine
|
9
|
-
-
|
9
|
+
- Erin Dees
|
10
|
+
- Rachel Klein
|
10
11
|
autorequire:
|
11
12
|
bindir: bin
|
12
13
|
cert_chain: []
|
13
|
-
date: 2018-
|
14
|
+
date: 2018-04-25 00:00:00.000000000 Z
|
14
15
|
dependencies:
|
15
16
|
- !ruby/object:Gem::Dependency
|
16
17
|
name: rake
|
@@ -83,19 +84,47 @@ dependencies:
|
|
83
84
|
- !ruby/object:Gem::Version
|
84
85
|
version: 3.2.13
|
85
86
|
- !ruby/object:Gem::Dependency
|
86
|
-
name:
|
87
|
+
name: json
|
88
|
+
requirement: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: 2.0.2
|
93
|
+
type: :development
|
94
|
+
prerelease: false
|
95
|
+
version_requirements: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: 2.0.2
|
100
|
+
- !ruby/object:Gem::Dependency
|
101
|
+
name: pry-nav
|
102
|
+
requirement: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - "~>"
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: 0.2.4
|
107
|
+
type: :development
|
108
|
+
prerelease: false
|
109
|
+
version_requirements: !ruby/object:Gem::Requirement
|
110
|
+
requirements:
|
111
|
+
- - "~>"
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: 0.2.4
|
114
|
+
- !ruby/object:Gem::Dependency
|
115
|
+
name: pry-stack_explorer
|
87
116
|
requirement: !ruby/object:Gem::Requirement
|
88
117
|
requirements:
|
89
118
|
- - "~>"
|
90
119
|
- !ruby/object:Gem::Version
|
91
|
-
version: 0.9
|
120
|
+
version: 0.4.9
|
92
121
|
type: :development
|
93
122
|
prerelease: false
|
94
123
|
version_requirements: !ruby/object:Gem::Requirement
|
95
124
|
requirements:
|
96
125
|
- - "~>"
|
97
126
|
- !ruby/object:Gem::Version
|
98
|
-
version: 0.9
|
127
|
+
version: 0.4.9
|
99
128
|
- !ruby/object:Gem::Dependency
|
100
129
|
name: hometown
|
101
130
|
requirement: !ruby/object:Gem::Requirement
|
@@ -166,6 +195,7 @@ files:
|
|
166
195
|
- init.rb
|
167
196
|
- install.rb
|
168
197
|
- lib/new_relic/agent.rb
|
198
|
+
- lib/new_relic/agent/adaptive_sampler.rb
|
169
199
|
- lib/new_relic/agent/agent.rb
|
170
200
|
- lib/new_relic/agent/agent_logger.rb
|
171
201
|
- lib/new_relic/agent/attribute_filter.rb
|
@@ -208,7 +238,6 @@ files:
|
|
208
238
|
- lib/new_relic/agent/deprecator.rb
|
209
239
|
- lib/new_relic/agent/distributed_trace_monitor.rb
|
210
240
|
- lib/new_relic/agent/distributed_trace_payload.rb
|
211
|
-
- lib/new_relic/agent/distributed_trace_priority_sampled_buffer.rb
|
212
241
|
- lib/new_relic/agent/encoding_normalizer.rb
|
213
242
|
- lib/new_relic/agent/error_collector.rb
|
214
243
|
- lib/new_relic/agent/error_event_aggregator.rb
|
@@ -219,6 +248,7 @@ files:
|
|
219
248
|
- lib/new_relic/agent/event_loop.rb
|
220
249
|
- lib/new_relic/agent/external.rb
|
221
250
|
- lib/new_relic/agent/harvester.rb
|
251
|
+
- lib/new_relic/agent/heap.rb
|
222
252
|
- lib/new_relic/agent/hostname.rb
|
223
253
|
- lib/new_relic/agent/http_clients/abstract_request.rb
|
224
254
|
- lib/new_relic/agent/http_clients/curb_wrappers.rb
|
@@ -308,6 +338,7 @@ files:
|
|
308
338
|
- lib/new_relic/agent/pipe_channel_manager.rb
|
309
339
|
- lib/new_relic/agent/pipe_service.rb
|
310
340
|
- lib/new_relic/agent/prepend_supportability.rb
|
341
|
+
- lib/new_relic/agent/priority_sampled_buffer.rb
|
311
342
|
- lib/new_relic/agent/range_extensions.rb
|
312
343
|
- lib/new_relic/agent/rules_engine.rb
|
313
344
|
- lib/new_relic/agent/rules_engine/replacement_rule.rb
|
@@ -335,7 +366,6 @@ files:
|
|
335
366
|
- lib/new_relic/agent/threading/backtrace_node.rb
|
336
367
|
- lib/new_relic/agent/threading/backtrace_service.rb
|
337
368
|
- lib/new_relic/agent/threading/thread_profile.rb
|
338
|
-
- lib/new_relic/agent/throughput_monitor.rb
|
339
369
|
- lib/new_relic/agent/transaction.rb
|
340
370
|
- lib/new_relic/agent/transaction/abstract_segment.rb
|
341
371
|
- lib/new_relic/agent/transaction/attributes.rb
|
@@ -454,7 +484,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
454
484
|
version: 1.3.1
|
455
485
|
requirements: []
|
456
486
|
rubyforge_project:
|
457
|
-
rubygems_version: 2.
|
487
|
+
rubygems_version: 2.7.6
|
458
488
|
signing_key:
|
459
489
|
specification_version: 4
|
460
490
|
summary: New Relic Ruby Agent
|
@@ -1,72 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
# This file is distributed under New Relic's license terms.
|
3
|
-
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
|
4
|
-
|
5
|
-
require 'new_relic/agent/event_buffer'
|
6
|
-
require 'set'
|
7
|
-
|
8
|
-
module NewRelic
|
9
|
-
module Agent
|
10
|
-
class DistributedTracePrioritySampledBuffer < SampledBuffer
|
11
|
-
attr_reader :seen_lifetime, :captured_lifetime
|
12
|
-
|
13
|
-
def initialize(capacity)
|
14
|
-
@low_priority_indices = []
|
15
|
-
@high_priority_indices = Set.new
|
16
|
-
super
|
17
|
-
end
|
18
|
-
|
19
|
-
def append_sampled(x = nil, &blk)
|
20
|
-
raise ArgumentError, "Expected argument or block, but received both" if x && blk
|
21
|
-
|
22
|
-
@seen += 1
|
23
|
-
@seen_lifetime += 1
|
24
|
-
if @items.size < @capacity
|
25
|
-
x = blk.call if block_given?
|
26
|
-
insert_high_priority x
|
27
|
-
@captured_lifetime += 1
|
28
|
-
return x
|
29
|
-
elsif !@low_priority_indices.empty? # overwite random low priority sample
|
30
|
-
m = rand(@low_priority_indices.size)
|
31
|
-
insert_high_priority x, @low_priority_indices.delete_at(m)
|
32
|
-
return x
|
33
|
-
else
|
34
|
-
NewRelic::Agent.increment_metric "Supportability/DistributedTracing/SampledBufferFailure/BufferFull"
|
35
|
-
return nil
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
def append_event(x = nil, &blk)
|
40
|
-
raise ArgumentError, "Expected argument or block, but received both" if x && blk
|
41
|
-
|
42
|
-
if @items.size < @capacity
|
43
|
-
x = blk.call if block_given?
|
44
|
-
insert_low_priority x
|
45
|
-
@captured_lifetime += 1
|
46
|
-
return x
|
47
|
-
else
|
48
|
-
m = rand(@seen) # [0, @seen)
|
49
|
-
if m < @capacity && !@high_priority_indices.include?(m)
|
50
|
-
x = blk.call if block_given?
|
51
|
-
insert_low_priority x, m
|
52
|
-
return x
|
53
|
-
else
|
54
|
-
# discard current sample
|
55
|
-
return nil
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
def insert_low_priority x, index = @items.size
|
61
|
-
@items[index] = x
|
62
|
-
@low_priority_indices << index
|
63
|
-
end
|
64
|
-
|
65
|
-
def insert_high_priority x, index = @items.size
|
66
|
-
@items[index] = x
|
67
|
-
@high_priority_indices << index
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|