newrelic_rpm 6.2.0.354 → 6.7.0.359
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +27 -5
- data/CHANGELOG.md +157 -6
- data/lib/new_relic/agent.rb +49 -0
- data/lib/new_relic/agent/agent.rb +110 -146
- data/lib/new_relic/agent/commands/agent_command_router.rb +2 -21
- data/lib/new_relic/agent/configuration/default_source.rb +103 -41
- 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 +35 -1
- data/lib/new_relic/agent/connect/request_builder.rb +69 -0
- data/lib/new_relic/agent/connect/response_handler.rb +61 -0
- data/lib/new_relic/agent/cross_app_monitor.rb +1 -1
- 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/hostname.rb +1 -1
- 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 +46 -74
- data/lib/new_relic/agent/instrumentation/action_view_subscriber.rb +70 -53
- data/lib/new_relic/agent/instrumentation/active_record_notifications.rb +168 -0
- data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +40 -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/notifications_subscriber.rb +76 -0
- data/lib/new_relic/agent/instrumentation/{rails5 → rails_notifications}/action_cable.rb +5 -6
- data/lib/new_relic/agent/instrumentation/{rails5 → rails_notifications}/action_controller.rb +3 -3
- data/lib/new_relic/agent/instrumentation/{rails4 → rails_notifications}/action_view.rb +3 -3
- data/lib/new_relic/agent/javascript_instrumentor.rb +1 -1
- data/lib/new_relic/agent/logging.rb +125 -0
- data/lib/new_relic/agent/new_relic_service.rb +0 -4
- data/lib/new_relic/agent/parameter_filtering.rb +18 -5
- data/lib/new_relic/agent/priority_sampled_buffer.rb +2 -0
- data/lib/new_relic/agent/span_event_aggregator.rb +2 -5
- 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/tracer.rb +32 -0
- data/lib/new_relic/agent/transaction.rb +0 -2
- 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_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/control/class_methods.rb +7 -1
- data/lib/new_relic/control/frameworks/{rails5.rb → rails_notifications.rb} +1 -1
- 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 +7 -0
- data/test/agent_helper.rb +18 -5
- metadata +17 -16
- 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/instrumentation/active_record_4.rb +0 -42
- data/lib/new_relic/agent/instrumentation/active_record_5.rb +0 -41
- data/lib/new_relic/agent/instrumentation/evented_subscriber.rb +0 -104
- data/lib/new_relic/agent/instrumentation/rails4/action_controller.rb +0 -32
- data/lib/new_relic/agent/instrumentation/rails5/action_view.rb +0 -27
- data/lib/new_relic/agent/transaction/xray_sample_buffer.rb +0 -64
- data/lib/new_relic/control/frameworks/rails6.rb +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)
|
@@ -91,12 +91,8 @@ module NewRelic
|
|
91
91
|
:rails
|
92
92
|
when 3
|
93
93
|
:rails3
|
94
|
-
when 4
|
95
|
-
:
|
96
|
-
when 5
|
97
|
-
:rails5
|
98
|
-
when 6
|
99
|
-
:rails6
|
94
|
+
when 4..6
|
95
|
+
:rails_notifications
|
100
96
|
else
|
101
97
|
::NewRelic::Agent.logger.error "Detected unsupported Rails version #{Rails::VERSION::STRING}"
|
102
98
|
end
|
@@ -172,6 +168,16 @@ module NewRelic
|
|
172
168
|
end
|
173
169
|
end
|
174
170
|
|
171
|
+
def self.api_host
|
172
|
+
Proc.new do
|
173
|
+
if String(NewRelic::Agent.config[:license_key]).start_with? 'eu'
|
174
|
+
'rpm.eu.newrelic.com'
|
175
|
+
else
|
176
|
+
'rpm.newrelic.com'
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
175
181
|
def self.convert_to_regexp_list(raw_value)
|
176
182
|
value_list = convert_to_list(raw_value)
|
177
183
|
value_list.map do |value|
|
@@ -190,6 +196,15 @@ module NewRelic
|
|
190
196
|
end
|
191
197
|
end
|
192
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
|
+
|
193
208
|
def self.convert_to_constant_list(raw_value)
|
194
209
|
const_names = convert_to_list(raw_value)
|
195
210
|
const_names.map! do |class_name|
|
@@ -285,8 +300,17 @@ module NewRelic
|
|
285
300
|
:public => true,
|
286
301
|
:type => String,
|
287
302
|
:allowed_from_server => false,
|
303
|
+
:transform => DefaultSource.method(:convert_to_list_on_semicolon),
|
288
304
|
: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>.'
|
289
305
|
},
|
306
|
+
:entity_guid => {
|
307
|
+
:default => nil,
|
308
|
+
:allow_nil => true,
|
309
|
+
:public => true,
|
310
|
+
:type => String,
|
311
|
+
:allowed_from_server => true,
|
312
|
+
:description => 'The <a href="https://docs.newrelic.com/attribute-dictionary/span/entityguid">Entity GUID</a> for the entity running this agent.'
|
313
|
+
},
|
290
314
|
:monitor_mode => {
|
291
315
|
:default => value_of(:enabled),
|
292
316
|
:public => true,
|
@@ -472,7 +496,7 @@ module NewRelic
|
|
472
496
|
:description => "URI for the New Relic data collection service."
|
473
497
|
},
|
474
498
|
:api_host => {
|
475
|
-
:default =>
|
499
|
+
:default => DefaultSource.api_host,
|
476
500
|
:public => false,
|
477
501
|
:type => String,
|
478
502
|
:allowed_from_server => false,
|
@@ -553,12 +577,52 @@ module NewRelic
|
|
553
577
|
:public => false,
|
554
578
|
:type => Integer,
|
555
579
|
:allowed_from_server => true,
|
556
|
-
:description => 'Number of seconds betwixt connections to the New Relic data collection service.
|
580
|
+
:description => 'Number of seconds betwixt connections to the New Relic data collection service.'
|
581
|
+
},
|
582
|
+
:event_report_period => {
|
583
|
+
:default => 60,
|
584
|
+
:public => false,
|
585
|
+
:type => Integer,
|
586
|
+
:allowed_from_server => true,
|
587
|
+
:description => 'Number of seconds betwixt connections to the New Relic event collection services.'
|
588
|
+
},
|
589
|
+
:'event_report_period.analytic_event_data' => {
|
590
|
+
:default => 60,
|
591
|
+
:public => false,
|
592
|
+
:type => Integer,
|
593
|
+
:dynamic_name => true,
|
594
|
+
:allowed_from_server => true,
|
595
|
+
:description => 'Number of seconds betwixt connections to the New Relic analytic event collection services.'
|
596
|
+
},
|
597
|
+
:'event_report_period.custom_event_data' => {
|
598
|
+
:default => 60,
|
599
|
+
:public => false,
|
600
|
+
:type => Integer,
|
601
|
+
:dynamic_name => true,
|
602
|
+
:allowed_from_server => true,
|
603
|
+
:description => 'Number of seconds betwixt connections to the New Relic custom event collection services.'
|
604
|
+
},
|
605
|
+
:'event_report_period.error_event_data' => {
|
606
|
+
:default => 60,
|
607
|
+
:public => false,
|
608
|
+
:type => Integer,
|
609
|
+
:dynamic_name => true,
|
610
|
+
:allowed_from_server => true,
|
611
|
+
:description => 'Number of seconds betwixt connections to the New Relic error event collection services.'
|
612
|
+
},
|
613
|
+
:'event_report_period.span_event_data' => {
|
614
|
+
:default => 60,
|
615
|
+
:public => false,
|
616
|
+
:type => Integer,
|
617
|
+
:dynamic_name => true,
|
618
|
+
:allowed_from_server => true,
|
619
|
+
:description => 'Number of seconds betwixt connections to the New Relic span event collection services.'
|
557
620
|
},
|
558
621
|
:'data_report_periods.analytic_event_data' => {
|
559
622
|
:default => 60,
|
560
623
|
:public => false,
|
561
624
|
:type => Integer,
|
625
|
+
:deprecated => true,
|
562
626
|
:dynamic_name => true,
|
563
627
|
:allowed_from_server => true,
|
564
628
|
:description => 'Number of seconds between connections to the New Relic data collection service for sending transaction event data.'
|
@@ -1003,6 +1067,7 @@ module NewRelic
|
|
1003
1067
|
:public => true,
|
1004
1068
|
:type => Boolean,
|
1005
1069
|
:allowed_from_server => true,
|
1070
|
+
:dynamic_name => true,
|
1006
1071
|
: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>.'
|
1007
1072
|
},
|
1008
1073
|
:'error_collector.max_event_samples_stored' => {
|
@@ -1157,35 +1222,7 @@ module NewRelic
|
|
1157
1222
|
:allowed_from_server => true,
|
1158
1223
|
: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>.'
|
1159
1224
|
},
|
1160
|
-
:'
|
1161
|
-
:default => true,
|
1162
|
-
:public => true,
|
1163
|
-
:type => Boolean,
|
1164
|
-
:allowed_from_server => true,
|
1165
|
-
: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>.'
|
1166
|
-
},
|
1167
|
-
:'xray_session.allow_traces' => {
|
1168
|
-
:default => true,
|
1169
|
-
:public => false,
|
1170
|
-
:type => Boolean,
|
1171
|
-
:allowed_from_server => true,
|
1172
|
-
:description => 'Enable or disable X-Ray sessions recording transaction traces.'
|
1173
|
-
},
|
1174
|
-
:'xray_session.allow_profiles' => {
|
1175
|
-
:default => true,
|
1176
|
-
:public => false,
|
1177
|
-
:type => Boolean,
|
1178
|
-
:allowed_from_server => true,
|
1179
|
-
:description => 'Enable or disable X-Ray sessions taking thread profiles.'
|
1180
|
-
},
|
1181
|
-
:'xray_session.max_samples' => {
|
1182
|
-
:default => 10,
|
1183
|
-
:public => false,
|
1184
|
-
:type => Integer,
|
1185
|
-
:allowed_from_server => true,
|
1186
|
-
:description => 'Maximum number of transaction traces to buffer for active X-Ray sessions'
|
1187
|
-
},
|
1188
|
-
:'xray_session.max_profile_overhead' => {
|
1225
|
+
:'thread_profiler.max_profile_overhead' => {
|
1189
1226
|
:default => 0.05,
|
1190
1227
|
:public => false,
|
1191
1228
|
:type => Float,
|
@@ -1235,6 +1272,13 @@ module NewRelic
|
|
1235
1272
|
:allowed_from_server => false,
|
1236
1273
|
:description => 'Controls whether to normalize string encodings prior to serializing data for the collector to JSON.'
|
1237
1274
|
},
|
1275
|
+
:backport_fast_active_record_connection_lookup => {
|
1276
|
+
:default => false,
|
1277
|
+
:public => true,
|
1278
|
+
:type => Boolean,
|
1279
|
+
:allowed_from_server => false,
|
1280
|
+
: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.'
|
1281
|
+
},
|
1238
1282
|
:disable_vm_sampler => {
|
1239
1283
|
:default => false,
|
1240
1284
|
:public => true,
|
@@ -1273,7 +1317,12 @@ module NewRelic
|
|
1273
1317
|
:type => Boolean,
|
1274
1318
|
:dynamic_name => true,
|
1275
1319
|
:allowed_from_server => false,
|
1276
|
-
:
|
1320
|
+
:deprecated => true,
|
1321
|
+
:description => 'Deprecated. ' \
|
1322
|
+
'For agent versions 6.3 or higher, ' \
|
1323
|
+
'use <a href="#disable_active_record_notifications"><code>' \
|
1324
|
+
'disable_active_record_notifications' \
|
1325
|
+
'</code></a> instead.'
|
1277
1326
|
},
|
1278
1327
|
:disable_active_record_5 => {
|
1279
1328
|
:default => false,
|
@@ -1281,7 +1330,20 @@ module NewRelic
|
|
1281
1330
|
:type => Boolean,
|
1282
1331
|
:dynamic_name => true,
|
1283
1332
|
:allowed_from_server => false,
|
1284
|
-
:
|
1333
|
+
:deprecated => true,
|
1334
|
+
:description => 'Deprecated. ' \
|
1335
|
+
'For agent versions 6.3 or higher, ' \
|
1336
|
+
'use <a href="#disable_active_record_notifications"><code>' \
|
1337
|
+
'disable_active_record_notifications' \
|
1338
|
+
'</code></a> instead.'
|
1339
|
+
},
|
1340
|
+
:disable_active_record_notifications => {
|
1341
|
+
:default => false,
|
1342
|
+
:public => true,
|
1343
|
+
:type => Boolean,
|
1344
|
+
:dynamic_name => true,
|
1345
|
+
:allowed_from_server => false,
|
1346
|
+
:description => 'If <code>true</code>, disables instrumentation for ActiveRecord 4, 5, and 6.'
|
1285
1347
|
},
|
1286
1348
|
:disable_bunny => {
|
1287
1349
|
:default => false,
|
@@ -1793,14 +1855,14 @@ module NewRelic
|
|
1793
1855
|
},
|
1794
1856
|
:'span_events.enabled' => {
|
1795
1857
|
:default => true,
|
1796
|
-
:public =>
|
1858
|
+
:public => true,
|
1797
1859
|
:type => Boolean,
|
1798
1860
|
:allowed_from_server => true,
|
1799
1861
|
:description => 'If <code>true</code>, enables span event sampling.'
|
1800
1862
|
},
|
1801
1863
|
:'span_events.max_samples_stored' => {
|
1802
1864
|
:default => 1000,
|
1803
|
-
:public =>
|
1865
|
+
:public => true,
|
1804
1866
|
:type => Integer,
|
1805
1867
|
:allowed_from_server => true,
|
1806
1868
|
: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
|
|
@@ -20,8 +20,8 @@ module NewRelic
|
|
20
20
|
"browser_monitoring.loader_version",
|
21
21
|
"cross_process_id",
|
22
22
|
"data_report_period",
|
23
|
-
"data_report_periods.analytic_event_data",
|
24
23
|
"encoding_key",
|
24
|
+
"entity_guid",
|
25
25
|
"error_beacon",
|
26
26
|
"js_agent_file",
|
27
27
|
"js_agent_loader",
|
@@ -39,6 +39,7 @@ module NewRelic
|
|
39
39
|
merge_top_level_keys(merged_settings, connect_reply)
|
40
40
|
merge_agent_config_hash(merged_settings, connect_reply)
|
41
41
|
fix_transaction_threshold(merged_settings)
|
42
|
+
add_event_harvest_config(merged_settings, connect_reply)
|
42
43
|
filter_keys(merged_settings)
|
43
44
|
|
44
45
|
apply_feature_gates(merged_settings, connect_reply, existing_config)
|
@@ -74,6 +75,39 @@ module NewRelic
|
|
74
75
|
end
|
75
76
|
end
|
76
77
|
|
78
|
+
EVENT_HARVEST_CONFIG_SUPPORTABILITY_METRIC_NAMES = {
|
79
|
+
:'analytics_events.max_samples_stored' => 'Supportability/EventHarvest/AnalyticEventData/HarvestLimit',
|
80
|
+
:'custom_insights_events.max_samples_stored' => 'Supportability/EventHarvest/CustomEventData/HarvestLimit',
|
81
|
+
:'error_collector.max_event_samples_stored'=> 'Supportability/EventHarvest/ErrorEventData/HarvestLimit',
|
82
|
+
:'span_events.max_samples_stored'=> 'Supportability/EventHarvest/SpanEventData/HarvestLimit',
|
83
|
+
:event_report_period => 'Supportability/EventHarvest/ReportPeriod'
|
84
|
+
}
|
85
|
+
|
86
|
+
def add_event_harvest_config(merged_settings, connect_reply)
|
87
|
+
return unless event_harvest_config_is_valid connect_reply
|
88
|
+
|
89
|
+
event_harvest_config = EventHarvestConfig.to_config_hash(connect_reply)
|
90
|
+
EVENT_HARVEST_CONFIG_SUPPORTABILITY_METRIC_NAMES.each do |config_key, metric_name|
|
91
|
+
NewRelic::Agent.record_metric metric_name, event_harvest_config[config_key]
|
92
|
+
end
|
93
|
+
|
94
|
+
merged_settings.merge! event_harvest_config
|
95
|
+
end
|
96
|
+
|
97
|
+
def event_harvest_config_is_valid connect_reply
|
98
|
+
event_harvest_config = connect_reply['event_harvest_config']
|
99
|
+
|
100
|
+
if event_harvest_config.nil? \
|
101
|
+
|| event_harvest_config['harvest_limits'].values.min < 0 \
|
102
|
+
|| (event_harvest_config['report_period_ms'] / 1000) <= 0
|
103
|
+
NewRelic::Agent.logger.warn "Invalid event harvest config found " \
|
104
|
+
"in connect response; using default event report period."
|
105
|
+
false
|
106
|
+
else
|
107
|
+
true
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
77
111
|
def filter_keys(merged_settings)
|
78
112
|
merged_settings.delete_if do |key, _|
|
79
113
|
setting_spec = DEFAULTS[key.to_sym]
|