newrelic_rpm 6.3.0.355 → 6.8.0.360
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +50 -10
- data/CHANGELOG.md +198 -0
- data/Guardfile +7 -1
- data/lib/new_relic/agent.rb +80 -0
- data/lib/new_relic/agent/agent.rb +87 -26
- data/lib/new_relic/agent/agent_logger.rb +4 -0
- data/lib/new_relic/agent/attribute_filter.rb +7 -7
- data/lib/new_relic/agent/attributes.rb +152 -0
- data/lib/new_relic/agent/autostart.rb +19 -14
- data/lib/new_relic/agent/commands/agent_command_router.rb +2 -21
- data/lib/new_relic/agent/configuration/default_source.rb +129 -39
- data/lib/new_relic/agent/configuration/environment_source.rb +4 -2
- data/lib/new_relic/agent/configuration/event_harvest_config.rb +45 -0
- data/lib/new_relic/agent/configuration/high_security_source.rb +1 -0
- data/lib/new_relic/agent/configuration/manager.rb +13 -9
- data/lib/new_relic/agent/configuration/server_source.rb +33 -9
- data/lib/new_relic/agent/configuration/yaml_source.rb +10 -5
- data/lib/new_relic/agent/connect/request_builder.rb +11 -13
- data/lib/new_relic/agent/connect/response_handler.rb +1 -1
- data/lib/new_relic/agent/cross_app_monitor.rb +1 -1
- data/lib/new_relic/agent/datastores/mongo/event_formatter.rb +2 -2
- data/lib/new_relic/agent/datastores/mongo/obfuscator.rb +8 -8
- data/lib/new_relic/agent/distributed_trace_intrinsics.rb +90 -0
- data/lib/new_relic/agent/distributed_trace_metrics.rb +74 -0
- data/lib/new_relic/agent/distributed_trace_monitor.rb +2 -12
- data/lib/new_relic/agent/distributed_trace_payload.rb +9 -76
- data/lib/new_relic/agent/distributed_trace_transport_type.rb +43 -0
- data/lib/new_relic/agent/error_collector.rb +2 -2
- data/lib/new_relic/agent/error_event_aggregator.rb +2 -1
- data/lib/new_relic/agent/error_trace_aggregator.rb +1 -0
- data/lib/new_relic/agent/event_aggregator.rb +26 -32
- data/lib/new_relic/agent/guid_generator.rb +28 -0
- data/lib/new_relic/agent/inbound_request_monitor.rb +2 -2
- data/lib/new_relic/agent/instrumentation/action_cable_subscriber.rb +24 -42
- data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +45 -69
- data/lib/new_relic/agent/instrumentation/action_view_subscriber.rb +70 -53
- data/lib/new_relic/agent/instrumentation/active_record_notifications.rb +25 -18
- data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +33 -47
- data/lib/new_relic/agent/instrumentation/active_storage_subscriber.rb +4 -4
- data/lib/new_relic/agent/instrumentation/grape.rb +2 -3
- data/lib/new_relic/agent/instrumentation/{evented_subscriber.rb → notifications_subscriber.rb} +7 -66
- data/lib/new_relic/agent/instrumentation/rails_notifications/action_cable.rb +2 -3
- data/lib/new_relic/agent/javascript_instrumentor.rb +1 -1
- data/lib/new_relic/agent/logging.rb +129 -0
- data/lib/new_relic/agent/new_relic_service.rb +7 -9
- data/lib/new_relic/agent/priority_sampled_buffer.rb +2 -0
- data/lib/new_relic/agent/span_event_aggregator.rb +2 -4
- data/lib/new_relic/agent/span_event_primitive.rb +29 -7
- data/lib/new_relic/agent/sql_sampler.rb +1 -1
- data/lib/new_relic/agent/threading/backtrace_service.rb +3 -3
- data/lib/new_relic/agent/threading/thread_profile.rb +9 -23
- data/lib/new_relic/agent/trace_context.rb +244 -0
- data/lib/new_relic/agent/trace_context_payload.rb +134 -0
- data/lib/new_relic/agent/trace_context_request_monitor.rb +42 -0
- data/lib/new_relic/agent/tracer.rb +32 -0
- data/lib/new_relic/agent/transaction.rb +26 -20
- data/lib/new_relic/agent/transaction/abstract_segment.rb +2 -2
- data/lib/new_relic/agent/transaction/distributed_tracing.rb +20 -101
- data/lib/new_relic/agent/transaction/external_request_segment.rb +18 -5
- data/lib/new_relic/agent/transaction/segment.rb +7 -1
- data/lib/new_relic/agent/transaction/trace.rb +3 -8
- data/lib/new_relic/agent/transaction/trace_builder.rb +0 -1
- data/lib/new_relic/agent/transaction/trace_context.rb +159 -0
- data/lib/new_relic/agent/transaction/trace_node.rb +8 -3
- data/lib/new_relic/agent/transaction_error_primitive.rb +4 -11
- data/lib/new_relic/agent/transaction_event_primitive.rb +3 -11
- data/lib/new_relic/agent/transaction_event_recorder.rb +3 -3
- data/lib/new_relic/agent/transaction_sampler.rb +1 -5
- data/lib/new_relic/cli/commands/deployments.rb +1 -1
- data/lib/new_relic/coerce.rb +29 -6
- data/lib/new_relic/control/instance_methods.rb +10 -1
- data/lib/new_relic/dependency_detection.rb +4 -4
- data/lib/new_relic/noticed_error.rb +8 -4
- data/lib/new_relic/rack/browser_monitoring.rb +10 -8
- data/lib/new_relic/version.rb +1 -1
- data/lib/tasks/config.rake +1 -2
- data/newrelic_rpm.gemspec +13 -4
- data/test/agent_helper.rb +95 -9
- data/true +0 -0
- metadata +58 -24
- data/lib/new_relic/agent/commands/xray_session.rb +0 -55
- data/lib/new_relic/agent/commands/xray_session_collection.rb +0 -161
- data/lib/new_relic/agent/configuration/event_data.rb +0 -39
- data/lib/new_relic/agent/transaction/attributes.rb +0 -154
- data/lib/new_relic/agent/transaction/xray_sample_buffer.rb +0 -64
- data/lib/tasks/versions.html.erb +0 -28
- data/lib/tasks/versions.postface.html +0 -8
- data/lib/tasks/versions.preface.html +0 -9
- data/lib/tasks/versions.rake +0 -65
- data/lib/tasks/versions.txt.erb +0 -14
@@ -9,7 +9,6 @@
|
|
9
9
|
# like the ThreadProfiler, so it's simpler to just keep it together here.
|
10
10
|
|
11
11
|
require 'new_relic/agent/commands/agent_command'
|
12
|
-
require 'new_relic/agent/commands/xray_session_collection'
|
13
12
|
require 'new_relic/agent/threading/backtrace_service'
|
14
13
|
|
15
14
|
module NewRelic
|
@@ -18,8 +17,7 @@ module NewRelic
|
|
18
17
|
class AgentCommandRouter
|
19
18
|
attr_reader :handlers
|
20
19
|
|
21
|
-
attr_accessor :thread_profiler_session, :backtrace_service
|
22
|
-
:xray_session_collection
|
20
|
+
attr_accessor :thread_profiler_session, :backtrace_service
|
23
21
|
|
24
22
|
def initialize(event_listener=nil)
|
25
23
|
@handlers = Hash.new { |*| Proc.new { |cmd| self.unrecognized_agent_command(cmd) } }
|
@@ -27,11 +25,9 @@ module NewRelic
|
|
27
25
|
@backtrace_service = Threading::BacktraceService.new(event_listener)
|
28
26
|
|
29
27
|
@thread_profiler_session = ThreadProfilerSession.new(@backtrace_service)
|
30
|
-
@xray_session_collection = XraySessionCollection.new(@backtrace_service, event_listener)
|
31
28
|
|
32
29
|
@handlers['start_profiler'] = Proc.new { |cmd| thread_profiler_session.handle_start_command(cmd) }
|
33
30
|
@handlers['stop_profiler'] = Proc.new { |cmd| thread_profiler_session.handle_stop_command(cmd) }
|
34
|
-
@handlers['active_xray_sessions'] = Proc.new { |cmd| xray_session_collection.handle_active_xray_sessions(cmd) }
|
35
31
|
|
36
32
|
if event_listener
|
37
33
|
event_listener.subscribe(:before_shutdown, &method(:on_before_shutdown))
|
@@ -45,20 +41,10 @@ module NewRelic
|
|
45
41
|
def check_for_and_handle_agent_commands
|
46
42
|
commands = get_agent_commands
|
47
43
|
|
48
|
-
stop_xray_sessions unless active_xray_command?(commands)
|
49
|
-
|
50
44
|
results = invoke_commands(commands)
|
51
45
|
new_relic_service.agent_command_results(results) unless results.empty?
|
52
46
|
end
|
53
47
|
|
54
|
-
def stop_xray_sessions
|
55
|
-
self.xray_session_collection.stop_all_sessions
|
56
|
-
end
|
57
|
-
|
58
|
-
def active_xray_command?(commands)
|
59
|
-
commands.any? {|command| command.name == 'active_xray_sessions'}
|
60
|
-
end
|
61
|
-
|
62
48
|
def on_before_shutdown(*args)
|
63
49
|
if self.thread_profiler_session.running?
|
64
50
|
self.thread_profiler_session.stop(true)
|
@@ -67,7 +53,6 @@ module NewRelic
|
|
67
53
|
|
68
54
|
def harvest!
|
69
55
|
profiles = []
|
70
|
-
profiles += harvest_from_xray_session_collection
|
71
56
|
profiles += harvest_from_thread_profiler_session
|
72
57
|
log_profiles(profiles)
|
73
58
|
profiles
|
@@ -76,14 +61,10 @@ module NewRelic
|
|
76
61
|
# We don't currently support merging thread profiles that failed to send
|
77
62
|
# back into the AgentCommandRouter, so we just no-op this method.
|
78
63
|
# Same with reset! - we don't support asynchronous cancellation of a
|
79
|
-
# running thread profile
|
64
|
+
# running thread profile currently.
|
80
65
|
def merge!(*args); end
|
81
66
|
def reset!; end
|
82
67
|
|
83
|
-
def harvest_from_xray_session_collection
|
84
|
-
self.xray_session_collection.harvest_thread_profiles
|
85
|
-
end
|
86
|
-
|
87
68
|
def harvest_from_thread_profiler_session
|
88
69
|
if self.thread_profiler_session.ready_to_harvest?
|
89
70
|
self.thread_profiler_session.stop(true)
|
@@ -196,6 +196,15 @@ module NewRelic
|
|
196
196
|
end
|
197
197
|
end
|
198
198
|
|
199
|
+
SEMICOLON = ';'.freeze
|
200
|
+
def self.convert_to_list_on_semicolon value
|
201
|
+
case value
|
202
|
+
when Array then value
|
203
|
+
when String then value.split(SEMICOLON)
|
204
|
+
else []
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
199
208
|
def self.convert_to_constant_list(raw_value)
|
200
209
|
const_names = convert_to_list(raw_value)
|
201
210
|
const_names.map! do |class_name|
|
@@ -209,9 +218,19 @@ module NewRelic
|
|
209
218
|
end
|
210
219
|
const_names.compact
|
211
220
|
end
|
221
|
+
|
222
|
+
def self.enforce_fallback(allowed_values: nil, fallback: nil)
|
223
|
+
Proc.new do |configured_value|
|
224
|
+
if allowed_values.any? { |v| v =~ /#{configured_value}/i }
|
225
|
+
configured_value
|
226
|
+
else
|
227
|
+
fallback
|
228
|
+
end
|
229
|
+
end
|
230
|
+
end
|
212
231
|
end
|
213
232
|
|
214
|
-
|
233
|
+
AUTOSTART_DENYLISTED_RAKE_TASKS = [
|
215
234
|
'about',
|
216
235
|
'assets:clean',
|
217
236
|
'assets:clobber',
|
@@ -291,8 +310,17 @@ module NewRelic
|
|
291
310
|
:public => true,
|
292
311
|
:type => String,
|
293
312
|
:allowed_from_server => false,
|
313
|
+
:transform => DefaultSource.method(:convert_to_list_on_semicolon),
|
294
314
|
:description => 'Specify the <a href="https://docs.newrelic.com/docs/apm/new-relic-apm/installation-configuration/name-your-application">application name</a> used to aggregate data in the New Relic UI. To report data to <a href="https://docs.newrelic.com/docs/apm/new-relic-apm/installation-configuration/using-multiple-names-app">multiple apps at the same time</a>, specify a list of names separated by a semicolon <code>;</code>. For example, <code>MyApp</code> or <code>MyStagingApp;Instance1</code>.'
|
295
315
|
},
|
316
|
+
:entity_guid => {
|
317
|
+
:default => nil,
|
318
|
+
:allow_nil => true,
|
319
|
+
:public => true,
|
320
|
+
:type => String,
|
321
|
+
:allowed_from_server => true,
|
322
|
+
:description => 'The <a href="https://docs.newrelic.com/attribute-dictionary/span/entityguid">Entity GUID</a> for the entity running this agent.'
|
323
|
+
},
|
296
324
|
:monitor_mode => {
|
297
325
|
:default => value_of(:enabled),
|
298
326
|
:public => true,
|
@@ -398,6 +426,17 @@ module NewRelic
|
|
398
426
|
:description => 'Autodetected application framework used to enable framework-specific functionality.'
|
399
427
|
},
|
400
428
|
:'autostart.blacklisted_constants' => {
|
429
|
+
:default => 'Rails::Console',
|
430
|
+
:public => true,
|
431
|
+
:type => String,
|
432
|
+
:allowed_from_server => false,
|
433
|
+
:description => 'Deprecated. ' \
|
434
|
+
'For agent versions 6.8.0 or higher, ' \
|
435
|
+
'use <a href="#autostart-denylisted_constants"><code>' \
|
436
|
+
'autostart.denylisted_constants' \
|
437
|
+
'</code></a> instead.'
|
438
|
+
},
|
439
|
+
:'autostart.denylisted_constants' => {
|
401
440
|
:default => 'Rails::Console',
|
402
441
|
:public => true,
|
403
442
|
:type => String,
|
@@ -409,10 +448,32 @@ module NewRelic
|
|
409
448
|
:public => true,
|
410
449
|
:type => String,
|
411
450
|
:allowed_from_server => false,
|
451
|
+
:description => 'Deprecated. ' \
|
452
|
+
'For agent versions 6.8.0 or higher, ' \
|
453
|
+
'use <a href="#autostart-denylisted_executables"><code>' \
|
454
|
+
'autostart.denylisted_executables' \
|
455
|
+
'</code></a> instead.'
|
456
|
+
},
|
457
|
+
:'autostart.denylisted_executables' => {
|
458
|
+
:default => value_of(:'autostart.blacklisted_executables'),
|
459
|
+
:public => true,
|
460
|
+
:type => String,
|
461
|
+
:allowed_from_server => false,
|
412
462
|
:description => 'Defines a comma-delimited list of executables that the agent should not instrument. For example, <code>rake,my_ruby_script.rb</code>.'
|
413
463
|
},
|
414
464
|
:'autostart.blacklisted_rake_tasks' => {
|
415
|
-
:default =>
|
465
|
+
:default => AUTOSTART_DENYLISTED_RAKE_TASKS,
|
466
|
+
:public => true,
|
467
|
+
:type => String,
|
468
|
+
:allowed_from_server => false,
|
469
|
+
:description => 'Deprecated. ' \
|
470
|
+
'For agent versions 6.8.0 or higher, ' \
|
471
|
+
'use <a href="#autostart-denylisted_rake_tasks"><code>' \
|
472
|
+
'autostart.denylisted_rake_tasks' \
|
473
|
+
'</code></a> instead.'
|
474
|
+
},
|
475
|
+
:'autostart.denylisted_rake_tasks' => {
|
476
|
+
:default => value_of(:'autostart.blacklisted_rake_tasks'),
|
416
477
|
:public => true,
|
417
478
|
:type => String,
|
418
479
|
:allowed_from_server => false,
|
@@ -460,15 +521,29 @@ module NewRelic
|
|
460
521
|
:public => true,
|
461
522
|
:type => Boolean,
|
462
523
|
:allowed_from_server => false,
|
463
|
-
:description => 'If true, the agent strips messages from all exceptions except those in the <a href="#strip_exception_messages-
|
524
|
+
:description => 'If true, the agent strips messages from all exceptions except those in the <a href="#strip_exception_messages-allowlist">allowlist</a>. Enabled automatically in <a href="https://docs.newrelic.com/docs/accounts-partnerships/accounts/security/high-security">high security mode</a>.'
|
464
525
|
},
|
465
526
|
:'strip_exception_messages.whitelist' => {
|
466
527
|
:default => '',
|
467
528
|
:public => true,
|
468
529
|
:type => String,
|
530
|
+
:deprecated => true,
|
531
|
+
:allowed_from_server => false,
|
532
|
+
:transform => DefaultSource.method(:convert_to_constant_list),
|
533
|
+
:description => 'Deprecated. ' \
|
534
|
+
'For agent versions 6.8.0 or higher, ' \
|
535
|
+
'use <a href="#strip_exception_messages-allowlist"><code>' \
|
536
|
+
'strip_exception_messages.allowed_classes' \
|
537
|
+
'</code></a> instead.'
|
538
|
+
},
|
539
|
+
:'strip_exception_messages.allowed_classes' => {
|
540
|
+
:default => '',
|
541
|
+
:public => true,
|
542
|
+
:type => String,
|
543
|
+
:deprecated => true,
|
469
544
|
:allowed_from_server => false,
|
470
545
|
:transform => DefaultSource.method(:convert_to_constant_list),
|
471
|
-
:description => 'Specify a
|
546
|
+
:description => 'Specify a list of exceptions you do not want the agent to strip when <a href="#strip_exception_messages-enabled">strip_exception_messages</a> is <code>true</code>. Separate exceptions with a comma. For example, <code>"ImportantException,PreserveMessageException"</code>.'
|
472
547
|
},
|
473
548
|
:host => {
|
474
549
|
:default => DefaultSource.host,
|
@@ -527,7 +602,7 @@ module NewRelic
|
|
527
602
|
:description => 'Use HTTP PUT requests instead of POST.'
|
528
603
|
},
|
529
604
|
:compressed_content_encoding => {
|
530
|
-
:default => '
|
605
|
+
:default => 'gzip',
|
531
606
|
:public => false,
|
532
607
|
:type => String,
|
533
608
|
:allowed_from_server => false,
|
@@ -568,6 +643,38 @@ module NewRelic
|
|
568
643
|
:allowed_from_server => true,
|
569
644
|
:description => 'Number of seconds betwixt connections to the New Relic event collection services.'
|
570
645
|
},
|
646
|
+
:'event_report_period.analytic_event_data' => {
|
647
|
+
:default => 60,
|
648
|
+
:public => false,
|
649
|
+
:type => Integer,
|
650
|
+
:dynamic_name => true,
|
651
|
+
:allowed_from_server => true,
|
652
|
+
:description => 'Number of seconds betwixt connections to the New Relic analytic event collection services.'
|
653
|
+
},
|
654
|
+
:'event_report_period.custom_event_data' => {
|
655
|
+
:default => 60,
|
656
|
+
:public => false,
|
657
|
+
:type => Integer,
|
658
|
+
:dynamic_name => true,
|
659
|
+
:allowed_from_server => true,
|
660
|
+
:description => 'Number of seconds betwixt connections to the New Relic custom event collection services.'
|
661
|
+
},
|
662
|
+
:'event_report_period.error_event_data' => {
|
663
|
+
:default => 60,
|
664
|
+
:public => false,
|
665
|
+
:type => Integer,
|
666
|
+
:dynamic_name => true,
|
667
|
+
:allowed_from_server => true,
|
668
|
+
:description => 'Number of seconds betwixt connections to the New Relic error event collection services.'
|
669
|
+
},
|
670
|
+
:'event_report_period.span_event_data' => {
|
671
|
+
:default => 60,
|
672
|
+
:public => false,
|
673
|
+
:type => Integer,
|
674
|
+
:dynamic_name => true,
|
675
|
+
:allowed_from_server => true,
|
676
|
+
:description => 'Number of seconds betwixt connections to the New Relic span event collection services.'
|
677
|
+
},
|
571
678
|
:'data_report_periods.analytic_event_data' => {
|
572
679
|
:default => 60,
|
573
680
|
:public => false,
|
@@ -1017,6 +1124,7 @@ module NewRelic
|
|
1017
1124
|
:public => true,
|
1018
1125
|
:type => Boolean,
|
1019
1126
|
:allowed_from_server => true,
|
1127
|
+
:dynamic_name => true,
|
1020
1128
|
:description => 'If <code>true</code>, the agent collects <a href="https://docs.newrelic.com/docs/insights/new-relic-insights/decorating-events/error-event-default-attributes-insights">TransactionError events</a>.'
|
1021
1129
|
},
|
1022
1130
|
:'error_collector.max_event_samples_stored' => {
|
@@ -1171,35 +1279,7 @@ module NewRelic
|
|
1171
1279
|
:allowed_from_server => true,
|
1172
1280
|
:description => 'If <code>true</code>, enables use of the <a href="https://docs.newrelic.com/docs/apm/applications-menu/events/thread-profiler-tool">thread profiler</a>.'
|
1173
1281
|
},
|
1174
|
-
:'
|
1175
|
-
:default => true,
|
1176
|
-
:public => true,
|
1177
|
-
:type => Boolean,
|
1178
|
-
:allowed_from_server => true,
|
1179
|
-
:description => 'If <code>true</code>, enables <a href="https://docs.newrelic.com/docs/apm/transactions-menu/x-ray-sessions/x-ray-sessions">X-Ray sessions</a>.'
|
1180
|
-
},
|
1181
|
-
:'xray_session.allow_traces' => {
|
1182
|
-
:default => true,
|
1183
|
-
:public => false,
|
1184
|
-
:type => Boolean,
|
1185
|
-
:allowed_from_server => true,
|
1186
|
-
:description => 'Enable or disable X-Ray sessions recording transaction traces.'
|
1187
|
-
},
|
1188
|
-
:'xray_session.allow_profiles' => {
|
1189
|
-
:default => true,
|
1190
|
-
:public => false,
|
1191
|
-
:type => Boolean,
|
1192
|
-
:allowed_from_server => true,
|
1193
|
-
:description => 'Enable or disable X-Ray sessions taking thread profiles.'
|
1194
|
-
},
|
1195
|
-
:'xray_session.max_samples' => {
|
1196
|
-
:default => 10,
|
1197
|
-
:public => false,
|
1198
|
-
:type => Integer,
|
1199
|
-
:allowed_from_server => true,
|
1200
|
-
:description => 'Maximum number of transaction traces to buffer for active X-Ray sessions'
|
1201
|
-
},
|
1202
|
-
:'xray_session.max_profile_overhead' => {
|
1282
|
+
:'thread_profiler.max_profile_overhead' => {
|
1203
1283
|
:default => 0.05,
|
1204
1284
|
:public => false,
|
1205
1285
|
:type => Float,
|
@@ -1250,11 +1330,11 @@ module NewRelic
|
|
1250
1330
|
:description => 'Controls whether to normalize string encodings prior to serializing data for the collector to JSON.'
|
1251
1331
|
},
|
1252
1332
|
:backport_fast_active_record_connection_lookup => {
|
1253
|
-
:default =>
|
1254
|
-
:public =>
|
1333
|
+
:default => false,
|
1334
|
+
:public => true,
|
1255
1335
|
:type => Boolean,
|
1256
1336
|
:allowed_from_server => false,
|
1257
|
-
:description => '
|
1337
|
+
:description => 'Backports the faster ActiveRecord connection lookup introduced in Rails 6, which improves agent performance when instrumenting ActiveRecord. Note that this setting may not be compatible with other gems that patch ActiveRecord.'
|
1258
1338
|
},
|
1259
1339
|
:disable_vm_sampler => {
|
1260
1340
|
:default => false,
|
@@ -1808,6 +1888,16 @@ module NewRelic
|
|
1808
1888
|
:allowed_from_server => false,
|
1809
1889
|
:description => 'Distributed tracing lets you see the path that a request takes through your distributed system. Enabling distributed tracing changes the behavior of some New Relic features, so carefully consult the <a href="https://docs.newrelic.com/docs/transition-guide-distributed-tracing">transition guide</a> before you enable this feature.'
|
1810
1890
|
},
|
1891
|
+
:'distributed_tracing.format' => {
|
1892
|
+
:default => 'newrelic',
|
1893
|
+
:public => false,
|
1894
|
+
:type => String,
|
1895
|
+
:transform => DefaultSource.enforce_fallback(
|
1896
|
+
allowed_values: ['w3c', 'newrelic'],
|
1897
|
+
fallback: 'newrelic'),
|
1898
|
+
:allowed_from_server => false,
|
1899
|
+
:description => 'The format to use for distributed tracing if it is enabled. Options are w3c for W3C Trace Context or newrelic for New Relic Distriburted Tracing. Defaults to New Relic Distributed Tracing.'
|
1900
|
+
},
|
1811
1901
|
:trusted_account_key => {
|
1812
1902
|
:default => nil,
|
1813
1903
|
:allow_nil => true,
|
@@ -1832,14 +1922,14 @@ module NewRelic
|
|
1832
1922
|
},
|
1833
1923
|
:'span_events.enabled' => {
|
1834
1924
|
:default => true,
|
1835
|
-
:public =>
|
1925
|
+
:public => true,
|
1836
1926
|
:type => Boolean,
|
1837
1927
|
:allowed_from_server => true,
|
1838
1928
|
:description => 'If <code>true</code>, enables span event sampling.'
|
1839
1929
|
},
|
1840
1930
|
:'span_events.max_samples_stored' => {
|
1841
1931
|
:default => 1000,
|
1842
|
-
:public =>
|
1932
|
+
:public => true,
|
1843
1933
|
:type => Integer,
|
1844
1934
|
:allowed_from_server => true,
|
1845
1935
|
:description => 'Defines the maximum number of span events reported from a single harvest.'
|
@@ -9,7 +9,8 @@ module NewRelic
|
|
9
9
|
SUPPORTED_PREFIXES = /^new_relic_|^newrelic_/i
|
10
10
|
SPECIAL_CASE_KEYS = [
|
11
11
|
'NEW_RELIC_ENV', # read by NewRelic::Control::Frameworks::Ruby
|
12
|
-
'NEW_RELIC_LOG' # read by set_log_file
|
12
|
+
'NEW_RELIC_LOG', # read by set_log_file
|
13
|
+
/^NEW_RELIC_METADATA_/ # read by NewRelic::Agent::Connect::RequestBuilder
|
13
14
|
]
|
14
15
|
|
15
16
|
attr_accessor :alias_map, :type_map
|
@@ -66,7 +67,8 @@ module NewRelic
|
|
66
67
|
nr_env_var_keys = collect_new_relic_environment_variable_keys
|
67
68
|
|
68
69
|
nr_env_var_keys.each do |key|
|
69
|
-
next if SPECIAL_CASE_KEYS.
|
70
|
+
next if SPECIAL_CASE_KEYS.any? { |pattern| pattern === key.upcase }
|
71
|
+
|
70
72
|
set_value_from_environment_variable(key)
|
71
73
|
end
|
72
74
|
end
|
@@ -0,0 +1,45 @@
|
|
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
|
+
module NewRelic
|
6
|
+
module Agent
|
7
|
+
module Configuration
|
8
|
+
module EventHarvestConfig
|
9
|
+
|
10
|
+
extend self
|
11
|
+
|
12
|
+
EVENT_HARVEST_CONFIG_KEY_MAPPING = {
|
13
|
+
:analytic_event_data => :'analytics_events.max_samples_stored',
|
14
|
+
:custom_event_data => :'custom_insights_events.max_samples_stored',
|
15
|
+
:error_event_data => :'error_collector.max_event_samples_stored',
|
16
|
+
:span_event_data => :'span_events.max_samples_stored'
|
17
|
+
}
|
18
|
+
|
19
|
+
def from_config(config)
|
20
|
+
{:harvest_limits => EVENT_HARVEST_CONFIG_KEY_MAPPING.inject({}) do
|
21
|
+
|connect_payload, (connect_payload_key, config_key)|
|
22
|
+
connect_payload[connect_payload_key] = config[config_key]
|
23
|
+
connect_payload
|
24
|
+
end
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
def to_config_hash(connect_reply)
|
29
|
+
event_harvest_interval = connect_reply['event_harvest_config']['report_period_ms'] / 1000
|
30
|
+
config_hash = EVENT_HARVEST_CONFIG_KEY_MAPPING.inject({}) do
|
31
|
+
|event_harvest_config, (connect_payload_key, config_key)|
|
32
|
+
if harvest_limit = connect_reply['event_harvest_config']['harvest_limits'][connect_payload_key.to_s]
|
33
|
+
event_harvest_config[config_key] = harvest_limit
|
34
|
+
report_period_key = :"event_report_period.#{connect_payload_key}"
|
35
|
+
event_harvest_config[report_period_key] = event_harvest_interval
|
36
|
+
end
|
37
|
+
event_harvest_config
|
38
|
+
end
|
39
|
+
config_hash[:event_report_period] = event_harvest_interval
|
40
|
+
config_hash
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -13,6 +13,7 @@ module NewRelic
|
|
13
13
|
:capture_params => false,
|
14
14
|
:'resque.capture_params' => false,
|
15
15
|
:'sidekiq.capture_params' => false,
|
16
|
+
:'attributes.include' => [],
|
16
17
|
|
17
18
|
:'transaction_tracer.record_sql' => record_sql_setting(local_settings, :'transaction_tracer.record_sql'),
|
18
19
|
:'slow_sql.record_sql' => record_sql_setting(local_settings, :'slow_sql.record_sql'),
|
@@ -95,6 +95,7 @@ module NewRelic
|
|
95
95
|
reset_cache
|
96
96
|
log_config(:add, source)
|
97
97
|
|
98
|
+
notify_server_source_added if ServerSource === source
|
98
99
|
notify_finished_configuring if !was_finished && finished_configuring?
|
99
100
|
end
|
100
101
|
|
@@ -171,8 +172,19 @@ module NewRelic
|
|
171
172
|
end
|
172
173
|
end
|
173
174
|
|
175
|
+
# This event is intended to be fired every time the server source is
|
176
|
+
# applied. This happens after the agent's initial connect, and again
|
177
|
+
# on every forced reconnect.
|
178
|
+
def notify_server_source_added
|
179
|
+
NewRelic::Agent.instance.events.notify(:server_source_configuration_added)
|
180
|
+
end
|
181
|
+
|
182
|
+
# This event is intended to be fired once during the entire lifespan of
|
183
|
+
# an agent run, after the server source has been applied for the first
|
184
|
+
# time. This should indicate that all configuration has been applied,
|
185
|
+
# and the main functions of the agent are safe to start.
|
174
186
|
def notify_finished_configuring
|
175
|
-
NewRelic::Agent.instance.events.notify(:
|
187
|
+
NewRelic::Agent.instance.events.notify(:initial_configuration_complete)
|
176
188
|
end
|
177
189
|
|
178
190
|
def finished_configuring?
|
@@ -216,14 +228,6 @@ module NewRelic
|
|
216
228
|
end
|
217
229
|
end
|
218
230
|
|
219
|
-
def app_names
|
220
|
-
case NewRelic::Agent.config[:app_name]
|
221
|
-
when Array then NewRelic::Agent.config[:app_name]
|
222
|
-
when String then NewRelic::Agent.config[:app_name].split(';')
|
223
|
-
else []
|
224
|
-
end
|
225
|
-
end
|
226
|
-
|
227
231
|
MALFORMED_LABELS_WARNING = "Skipping malformed labels configuration"
|
228
232
|
PARSING_LABELS_FAILURE = "Failure during parsing labels. Ignoring and carrying on with connect."
|
229
233
|
|