newrelic 7.5.2 → 8.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NEWS.md +4989 -4886
- package/THIRD_PARTY_NOTICES.md +625 -216
- package/api.js +105 -174
- package/bin/test-naming-rules.js +38 -32
- package/bin/tracetractor +0 -1
- package/index.js +12 -18
- package/lib/agent.js +108 -111
- package/lib/aggregators/base-aggregator.js +1 -1
- package/lib/aggregators/event-aggregator.js +6 -6
- package/lib/attributes.js +12 -13
- package/lib/collector/api.js +32 -42
- package/lib/collector/facts.js +67 -65
- package/lib/collector/http-agents.js +30 -27
- package/lib/collector/parse-response.js +1 -2
- package/lib/collector/remote-method.js +43 -36
- package/lib/collector/serverless.js +13 -18
- package/lib/collector/ssl/certificates.js +1056 -1056
- package/lib/config/attribute-filter.js +90 -82
- package/lib/config/default.js +30 -18
- package/lib/config/env.js +17 -12
- package/lib/config/harvest-config-validator.js +1 -1
- package/lib/config/index.js +160 -177
- package/lib/config/merge-server-config.js +7 -5
- package/lib/custom-events/custom-event-aggregator.js +1 -1
- package/lib/db/parse-sql.js +6 -9
- package/lib/db/parsed-statement.js +6 -13
- package/lib/db/query-parsers/sql.js +6 -9
- package/lib/db/query-sample.js +7 -3
- package/lib/db/query-trace-aggregator.js +12 -12
- package/lib/db/utils.js +1 -1
- package/lib/environment.js +173 -138
- package/lib/errors/error-collector.js +18 -31
- package/lib/errors/error-event-aggregator.js +1 -1
- package/lib/errors/error-trace-aggregator.js +2 -3
- package/lib/errors/helper.js +21 -30
- package/lib/errors/index.js +16 -28
- package/lib/feature_flags.js +5 -8
- package/lib/grpc/connection/states.js +6 -6
- package/lib/grpc/connection.js +35 -46
- package/lib/header-attributes.js +49 -53
- package/lib/instrumentation/amqplib.js +8 -17
- package/lib/instrumentation/bluebird.js +61 -20
- package/lib/instrumentation/cassandra-driver.js +2 -2
- package/lib/instrumentation/connect.js +4 -3
- package/lib/instrumentation/core/async_hooks.js +11 -4
- package/lib/instrumentation/core/child_process.js +20 -28
- package/lib/instrumentation/core/crypto.js +1 -7
- package/lib/instrumentation/core/dns.js +3 -7
- package/lib/instrumentation/core/domain.js +2 -8
- package/lib/instrumentation/core/fs.js +22 -37
- package/lib/instrumentation/core/globals.js +3 -7
- package/lib/instrumentation/core/http-outbound.js +15 -40
- package/lib/instrumentation/core/http.js +29 -63
- package/lib/instrumentation/core/inspector.js +6 -10
- package/lib/instrumentation/core/net.js +3 -1
- package/lib/instrumentation/core/timers.js +17 -24
- package/lib/instrumentation/core/zlib.js +2 -10
- package/lib/instrumentation/express.js +4 -2
- package/lib/instrumentation/fastify/spec-builders.js +5 -0
- package/lib/instrumentation/fastify.js +37 -10
- package/lib/instrumentation/hapi/hapi-17.js +9 -10
- package/lib/instrumentation/hapi.js +15 -15
- package/lib/instrumentation/ioredis.js +1 -2
- package/lib/instrumentation/memcached.js +39 -43
- package/lib/instrumentation/mongodb/common.js +218 -0
- package/lib/instrumentation/mongodb/constants.js +87 -0
- package/lib/instrumentation/mongodb/v2-mongo.js +110 -0
- package/lib/instrumentation/mongodb/v3-mongo.js +80 -0
- package/lib/instrumentation/mongodb/v4-mongo.js +90 -0
- package/lib/instrumentation/mongodb.js +20 -312
- package/lib/instrumentation/mysql.js +33 -26
- package/lib/instrumentation/oracle.js +10 -14
- package/lib/instrumentation/pg.js +30 -21
- package/lib/instrumentation/promise.js +20 -17
- package/lib/instrumentation/redis.js +30 -30
- package/lib/instrumentation/when.js +9 -1
- package/lib/instrumentations.js +24 -24
- package/lib/logger.js +1 -1
- package/lib/metrics/index.js +37 -17
- package/lib/metrics/mapper.js +9 -9
- package/lib/metrics/metric-aggregator.js +5 -10
- package/lib/metrics/names.js +8 -7
- package/lib/metrics/normalizer/rule.js +6 -7
- package/lib/metrics/normalizer/tx_segment.js +17 -13
- package/lib/metrics/normalizer.js +30 -33
- package/lib/metrics/recorders/custom.js +3 -1
- package/lib/metrics/recorders/distributed-trace.js +3 -18
- package/lib/metrics/recorders/generic.js +3 -2
- package/lib/metrics/recorders/http.js +4 -6
- package/lib/metrics/recorders/http_external.js +1 -3
- package/lib/metrics/recorders/message-transaction.js +2 -12
- package/lib/metrics/recorders/other.js +2 -12
- package/lib/parse-proc-cpuinfo.js +11 -16
- package/lib/parse-proc-meminfo.js +5 -3
- package/lib/prioritized-attributes.js +12 -17
- package/lib/priority-queue.js +1 -1
- package/lib/proxy/grpc.js +1 -1
- package/lib/reservoir.js +9 -3
- package/lib/sampler.js +12 -13
- package/lib/serverless/api-gateway.js +3 -3
- package/lib/serverless/aws-lambda.js +28 -37
- package/lib/shim/conglomerate-shim.js +4 -4
- package/lib/shim/datastore-shim.js +29 -38
- package/lib/shim/index.js +8 -9
- package/lib/shim/message-shim.js +111 -113
- package/lib/shim/promise-shim.js +18 -13
- package/lib/shim/shim.js +72 -66
- package/lib/shim/specs/index.js +18 -19
- package/lib/shim/transaction-shim.js +26 -36
- package/lib/shim/webframework-shim.js +25 -35
- package/lib/shimmer.js +184 -166
- package/lib/spans/create-span-event-aggregator.js +24 -44
- package/lib/spans/span-context.js +4 -10
- package/lib/spans/span-event-aggregator.js +68 -13
- package/lib/spans/span-event.js +5 -7
- package/lib/spans/span-streamer.js +10 -18
- package/lib/spans/streaming-span-event-aggregator.js +1 -1
- package/lib/spans/streaming-span-event.js +4 -4
- package/lib/stats/apdex.js +5 -11
- package/lib/stats/index.js +12 -17
- package/lib/system-info.js +7 -3
- package/lib/timer.js +30 -16
- package/lib/transaction/dt-payload.js +1 -1
- package/lib/transaction/handle.js +19 -19
- package/lib/transaction/index.js +94 -112
- package/lib/transaction/name-state.js +5 -6
- package/lib/transaction/trace/aggregator.js +78 -73
- package/lib/transaction/trace/exclusive-time-calculator.js +5 -9
- package/lib/transaction/trace/index.js +26 -24
- package/lib/transaction/trace/segment.js +39 -56
- package/lib/transaction/tracecontext.js +37 -45
- package/lib/transaction/tracer/index.js +79 -44
- package/lib/transaction/transaction-event-aggregator.js +29 -31
- package/lib/uninstrumented.js +4 -5
- package/lib/util/attribute-types.js +1 -5
- package/lib/util/byte-limit.js +0 -1
- package/lib/util/cat.js +5 -13
- package/lib/util/codec.js +8 -4
- package/lib/util/deep-equal.js +48 -18
- package/lib/util/flatten.js +5 -2
- package/lib/util/hashes.js +2 -2
- package/lib/util/label-parser.js +7 -13
- package/lib/util/logger.js +31 -13
- package/lib/util/process-version.js +1 -1
- package/lib/util/properties.js +1 -1
- package/lib/util/sql/obfuscate.js +7 -17
- package/lib/util/stream-sink.js +2 -3
- package/lib/util/urltils.js +9 -13
- package/lib/utilization/aws-info.js +2 -3
- package/lib/utilization/azure-info.js +32 -30
- package/lib/utilization/common.js +5 -4
- package/lib/utilization/docker-info.js +4 -6
- package/lib/utilization/gcp-info.js +36 -35
- package/lib/utilization/index.js +1 -1
- package/lib/utilization/kubernetes-info.js +2 -2
- package/lib/utilization/pcf-info.js +4 -4
- package/package.json +32 -18
- package/stub_api.js +8 -6
package/lib/config/index.js
CHANGED
|
@@ -10,14 +10,13 @@ const CollectorResponse = require('../collector/response')
|
|
|
10
10
|
const copy = require('../util/copy')
|
|
11
11
|
const defaultConfig = require('./default').config
|
|
12
12
|
const EventEmitter = require('events').EventEmitter
|
|
13
|
-
const
|
|
13
|
+
const featureFlag = require('../feature_flags')
|
|
14
14
|
const flatten = require('../util/flatten')
|
|
15
15
|
const fs = require('../util/unwrapped-core').fs
|
|
16
16
|
const hashes = require('../util/hashes')
|
|
17
17
|
const os = require('os')
|
|
18
18
|
const parseKey = require('../collector/key-parser').parseKey
|
|
19
19
|
const path = require('path')
|
|
20
|
-
const psemver = require('../util/process-version')
|
|
21
20
|
const stringify = require('json-stringify-safe')
|
|
22
21
|
const util = require('util')
|
|
23
22
|
const MergeServerConfig = require('./merge-server-config')
|
|
@@ -30,38 +29,32 @@ const mergeServerConfig = new MergeServerConfig()
|
|
|
30
29
|
const AZURE_APP_NAME = 'APP_POOL_ID'
|
|
31
30
|
const DEFAULT_MAX_PAYLOAD_SIZE_IN_BYTES = 1000000
|
|
32
31
|
const DEFAULT_CONFIG_PATH = require.resolve('./default')
|
|
33
|
-
const SPAN_EVENT_LIMIT = 1000
|
|
34
32
|
const BASE_CONFIG_PATH = require.resolve('../../newrelic')
|
|
35
|
-
const HAS_ARBITRARY_KEYS = new Set([
|
|
36
|
-
'ignore_messages',
|
|
37
|
-
'expected_messages',
|
|
38
|
-
'labels'
|
|
39
|
-
])
|
|
33
|
+
const HAS_ARBITRARY_KEYS = new Set(['ignore_messages', 'expected_messages', 'labels'])
|
|
40
34
|
|
|
41
35
|
const LASP_MAP = require('./lasp').LASP_MAP
|
|
42
36
|
const ENV = require('./env')
|
|
43
37
|
const HSM = require('./hsm')
|
|
38
|
+
const REMOVE_BEFORE_SEND = new Set(['attributeFilter'])
|
|
44
39
|
|
|
45
40
|
const exists = fs.existsSync || path.existsSync
|
|
46
41
|
let logger = null // Lazy-loaded in `initialize`.
|
|
47
42
|
let _configInstance = null
|
|
48
43
|
|
|
49
|
-
const getConfigFileNames = () =>
|
|
50
|
-
process.env.NEW_RELIC_CONFIG_FILENAME,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
: undefined
|
|
64
|
-
].filter(Boolean)
|
|
44
|
+
const getConfigFileNames = () =>
|
|
45
|
+
[process.env.NEW_RELIC_CONFIG_FILENAME, 'newrelic.js', 'newrelic.cjs'].filter(Boolean)
|
|
46
|
+
|
|
47
|
+
const getConfigFileLocations = () =>
|
|
48
|
+
[
|
|
49
|
+
process.env.NEW_RELIC_HOME,
|
|
50
|
+
process.cwd(),
|
|
51
|
+
process.env.HOME,
|
|
52
|
+
path.join(__dirname, '../../../..'), // above node_modules
|
|
53
|
+
// the REPL has no main module
|
|
54
|
+
process.mainModule && process.mainModule.filename
|
|
55
|
+
? path.dirname(process.mainModule.filename)
|
|
56
|
+
: undefined
|
|
57
|
+
].filter(Boolean)
|
|
65
58
|
|
|
66
59
|
function isTruthular(setting) {
|
|
67
60
|
if (setting == null) {
|
|
@@ -94,7 +87,7 @@ function fromObjectList(setting) {
|
|
|
94
87
|
|
|
95
88
|
function _findConfigFile() {
|
|
96
89
|
const configFileCandidates = getConfigFileLocations().reduce((files, configPath) => {
|
|
97
|
-
const configFiles = getConfigFileNames().map(filename =>
|
|
90
|
+
const configFiles = getConfigFileNames().map((filename) =>
|
|
98
91
|
path.join(path.resolve(configPath), filename)
|
|
99
92
|
)
|
|
100
93
|
|
|
@@ -118,7 +111,7 @@ function Config(config) {
|
|
|
118
111
|
|
|
119
112
|
// feature flags are mostly private settings for gating unreleased features
|
|
120
113
|
// flags are set in the feature_flags.js file
|
|
121
|
-
this.feature_flag = copy.shallow(
|
|
114
|
+
this.feature_flag = copy.shallow(featureFlag.prerelease)
|
|
122
115
|
|
|
123
116
|
// set by environment
|
|
124
117
|
this.newrelic_home = null
|
|
@@ -161,9 +154,9 @@ function Config(config) {
|
|
|
161
154
|
this.browser_monitoring.loader_version = ''
|
|
162
155
|
|
|
163
156
|
// Settings to play nice with DLPs (see NODE-1044).
|
|
164
|
-
this.compressed_content_encoding = 'deflate'
|
|
165
|
-
this.simple_compression = false
|
|
166
|
-
this.put_for_data_send = false
|
|
157
|
+
this.compressed_content_encoding = 'deflate' // Deflate or gzip
|
|
158
|
+
this.simple_compression = false // Disables subcomponent compression
|
|
159
|
+
this.put_for_data_send = false // Changes http verb for harvest
|
|
167
160
|
|
|
168
161
|
// 3. override defaults with values from the loaded / passed configuration
|
|
169
162
|
this._fromPassed(config)
|
|
@@ -189,7 +182,7 @@ function Config(config) {
|
|
|
189
182
|
analytic_event_data: this.transaction_events.max_samples_stored,
|
|
190
183
|
custom_event_data: this.custom_insights_events.max_samples_stored,
|
|
191
184
|
error_event_data: this.error_collector.max_event_samples_stored,
|
|
192
|
-
span_event_data:
|
|
185
|
+
span_event_data: this.span_events.max_samples_stored
|
|
193
186
|
}
|
|
194
187
|
}
|
|
195
188
|
}
|
|
@@ -202,9 +195,9 @@ function Config(config) {
|
|
|
202
195
|
if (this.security_policies_token) {
|
|
203
196
|
throw new Error(
|
|
204
197
|
'Security Policies and High Security Mode cannot both be present ' +
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
198
|
+
'in the agent configuration. If Security Policies have been set ' +
|
|
199
|
+
'for your account, please ensure the security_policies_token is ' +
|
|
200
|
+
'set but high_security is disabled (default).'
|
|
208
201
|
)
|
|
209
202
|
}
|
|
210
203
|
this._applyHighSecurity()
|
|
@@ -244,7 +237,9 @@ Config.prototype.onConnect = function onConnect(json, recursion) {
|
|
|
244
237
|
this.emit('agent_enabled', false)
|
|
245
238
|
return
|
|
246
239
|
}
|
|
247
|
-
if (Object.keys(json).length === 0)
|
|
240
|
+
if (Object.keys(json).length === 0) {
|
|
241
|
+
return
|
|
242
|
+
}
|
|
248
243
|
|
|
249
244
|
Object.keys(json).forEach(function updateProp(key) {
|
|
250
245
|
this._fromServer(json, key)
|
|
@@ -300,8 +295,7 @@ Config.prototype._fromServer = function _fromServer(params, key) {
|
|
|
300
295
|
case 'encoding_key':
|
|
301
296
|
this._alwaysUpdateIfChanged(params, key)
|
|
302
297
|
if (this.cross_process_id && this.encoding_key) {
|
|
303
|
-
this.obfuscatedId =
|
|
304
|
-
hashes.obfuscateNameUsingKey(this.cross_process_id, this.encoding_key)
|
|
298
|
+
this.obfuscatedId = hashes.obfuscateNameUsingKey(this.cross_process_id, this.encoding_key)
|
|
305
299
|
}
|
|
306
300
|
break
|
|
307
301
|
|
|
@@ -322,12 +316,7 @@ Config.prototype._fromServer = function _fromServer(params, key) {
|
|
|
322
316
|
|
|
323
317
|
case 'collect_error_events':
|
|
324
318
|
if (params.collect_error_events === false) {
|
|
325
|
-
this._updateNestedIfChanged(
|
|
326
|
-
params,
|
|
327
|
-
this.error_collector,
|
|
328
|
-
key,
|
|
329
|
-
'capture_events'
|
|
330
|
-
)
|
|
319
|
+
this._updateNestedIfChanged(params, this.error_collector, key, 'capture_events')
|
|
331
320
|
}
|
|
332
321
|
break
|
|
333
322
|
|
|
@@ -356,10 +345,7 @@ Config.prototype._fromServer = function _fromServer(params, key) {
|
|
|
356
345
|
this.emit(key, null)
|
|
357
346
|
break
|
|
358
347
|
}
|
|
359
|
-
logger.info(
|
|
360
|
-
'Valid event_harvest_config received. Updating harvest cycles.',
|
|
361
|
-
val
|
|
362
|
-
)
|
|
348
|
+
logger.info('Valid event_harvest_config received. Updating harvest cycles.', val)
|
|
363
349
|
const limits = Object.keys(val.harvest_limits).reduce((acc, k) => {
|
|
364
350
|
const v = val.harvest_limits[k]
|
|
365
351
|
if (harvestConfigValidator.isValidHarvestValue(v)) {
|
|
@@ -407,12 +393,7 @@ Config.prototype._fromServer = function _fromServer(params, key) {
|
|
|
407
393
|
// Browser Monitoring
|
|
408
394
|
//
|
|
409
395
|
case 'browser_monitoring.loader':
|
|
410
|
-
this._updateNestedIfChangedRaw(
|
|
411
|
-
params,
|
|
412
|
-
this.browser_monitoring,
|
|
413
|
-
key,
|
|
414
|
-
'loader'
|
|
415
|
-
)
|
|
396
|
+
this._updateNestedIfChangedRaw(params, this.browser_monitoring, key, 'loader')
|
|
416
397
|
break
|
|
417
398
|
|
|
418
399
|
// these are used by browser_monitoring
|
|
@@ -423,24 +404,14 @@ Config.prototype._fromServer = function _fromServer(params, key) {
|
|
|
423
404
|
case 'error_beacon':
|
|
424
405
|
case 'browser_key':
|
|
425
406
|
case 'js_agent_loader':
|
|
426
|
-
this._updateNestedIfChangedRaw(
|
|
427
|
-
params,
|
|
428
|
-
this.browser_monitoring,
|
|
429
|
-
key,
|
|
430
|
-
key
|
|
431
|
-
)
|
|
407
|
+
this._updateNestedIfChangedRaw(params, this.browser_monitoring, key, key)
|
|
432
408
|
break
|
|
433
409
|
|
|
434
410
|
//
|
|
435
411
|
// Cross Application Tracer
|
|
436
412
|
//
|
|
437
413
|
case 'cross_application_tracer.enabled':
|
|
438
|
-
this._updateNestedIfChanged(
|
|
439
|
-
params,
|
|
440
|
-
this.cross_application_tracer,
|
|
441
|
-
key,
|
|
442
|
-
'enabled'
|
|
443
|
-
)
|
|
414
|
+
this._updateNestedIfChanged(params, this.cross_application_tracer, key, 'enabled')
|
|
444
415
|
break
|
|
445
416
|
//
|
|
446
417
|
// Error Collector
|
|
@@ -531,12 +502,7 @@ Config.prototype._fromServer = function _fromServer(params, key) {
|
|
|
531
502
|
// Transaction Events
|
|
532
503
|
//
|
|
533
504
|
case 'transaction_events.enabled':
|
|
534
|
-
this._updateNestedIfChanged(
|
|
535
|
-
params,
|
|
536
|
-
this.transaction_events,
|
|
537
|
-
key,
|
|
538
|
-
'enabled'
|
|
539
|
-
)
|
|
505
|
+
this._updateNestedIfChanged(params, this.transaction_events, key, 'enabled')
|
|
540
506
|
break
|
|
541
507
|
|
|
542
508
|
//
|
|
@@ -577,6 +543,13 @@ Config.prototype._fromServer = function _fromServer(params, key) {
|
|
|
577
543
|
this.logUnsupported(params, key)
|
|
578
544
|
break
|
|
579
545
|
|
|
546
|
+
// DT span event harvest config limits
|
|
547
|
+
case 'span_event_harvest_config':
|
|
548
|
+
this.span_event_harvest_config = {
|
|
549
|
+
...params[key]
|
|
550
|
+
}
|
|
551
|
+
break
|
|
552
|
+
|
|
580
553
|
// These settings are not allowed from the server.
|
|
581
554
|
case 'attributes.enabled':
|
|
582
555
|
case 'attributes.exclude':
|
|
@@ -615,7 +588,9 @@ Config.prototype._alwaysUpdateIfChanged = function _alwaysUpdateIfChanged(json,
|
|
|
615
588
|
if (value != null && this[key] !== value) {
|
|
616
589
|
if (Array.isArray(value) && Array.isArray(this[key])) {
|
|
617
590
|
value.forEach(function pushIfNew(element) {
|
|
618
|
-
if (this[key].indexOf(element) === -1)
|
|
591
|
+
if (this[key].indexOf(element) === -1) {
|
|
592
|
+
this[key].push(element)
|
|
593
|
+
}
|
|
619
594
|
}, this)
|
|
620
595
|
} else {
|
|
621
596
|
this[key] = value
|
|
@@ -664,10 +639,11 @@ function _validateThenUpdateStatusCodes(remote, local, remoteKey, localKey) {
|
|
|
664
639
|
|
|
665
640
|
let valid = true
|
|
666
641
|
valueToTest.forEach(function validateArray(thingToTest) {
|
|
667
|
-
if (!('string' ===
|
|
642
|
+
if (!('string' === typeof thingToTest || 'number' === typeof thingToTest)) {
|
|
668
643
|
logger.warn(
|
|
669
644
|
'Saw SSC (ignore|expect)_status_code that is not a number or string,' +
|
|
670
|
-
|
|
645
|
+
'will not merge: %s',
|
|
646
|
+
thingToTest
|
|
671
647
|
)
|
|
672
648
|
valid = false
|
|
673
649
|
}
|
|
@@ -708,7 +684,7 @@ function _validateThenUpdateErrorClasses(remote, local, remoteKey, localKey) {
|
|
|
708
684
|
let valid = true
|
|
709
685
|
Object.keys(valueToTest).forEach(function validateArray(key) {
|
|
710
686
|
let thingToTest = valueToTest[key]
|
|
711
|
-
if ('string' !==
|
|
687
|
+
if ('string' !== typeof thingToTest) {
|
|
712
688
|
logger.warn(
|
|
713
689
|
'Saw SSC (ignore|expect)_class that is not a string, will not merge: %s',
|
|
714
690
|
thingToTest
|
|
@@ -742,10 +718,7 @@ Config.prototype._validateThenUpdateErrorMessages = _validateThenUpdateErrorMess
|
|
|
742
718
|
function _validateThenUpdateErrorMessages(remote, local, remoteKey, localKey) {
|
|
743
719
|
let valueToTest = remote[remoteKey]
|
|
744
720
|
if (Array.isArray(valueToTest)) {
|
|
745
|
-
logger.warn(
|
|
746
|
-
'Saw SSC (ignore|expect)_message that is an Array, will not merge: %s',
|
|
747
|
-
valueToTest
|
|
748
|
-
)
|
|
721
|
+
logger.warn('Saw SSC (ignore|expect)_message that is an Array, will not merge: %s', valueToTest)
|
|
749
722
|
return
|
|
750
723
|
}
|
|
751
724
|
|
|
@@ -771,10 +744,7 @@ function _validateThenUpdateErrorMessages(remote, local, remoteKey, localKey) {
|
|
|
771
744
|
Object.keys(valueToTest).forEach(function validateArray(key) {
|
|
772
745
|
let arrayToTest = valueToTest[key]
|
|
773
746
|
if (!Array.isArray(arrayToTest)) {
|
|
774
|
-
logger.warn(
|
|
775
|
-
'Saw SSC message array that is not an array, will not merge: %s',
|
|
776
|
-
arrayToTest
|
|
777
|
-
)
|
|
747
|
+
logger.warn('Saw SSC message array that is not an array, will not merge: %s', arrayToTest)
|
|
778
748
|
valid = false
|
|
779
749
|
}
|
|
780
750
|
})
|
|
@@ -824,7 +794,9 @@ function _updateNestedIfChangedRaw(remote, local, remoteKey, localKey) {
|
|
|
824
794
|
*/
|
|
825
795
|
Config.prototype._emitIfSet = function _emitIfSet(json, key) {
|
|
826
796
|
var value = json[key]
|
|
827
|
-
if (value != null)
|
|
797
|
+
if (value != null) {
|
|
798
|
+
this.emit(key, value)
|
|
799
|
+
}
|
|
828
800
|
}
|
|
829
801
|
|
|
830
802
|
/**
|
|
@@ -839,7 +811,7 @@ Config.prototype.logDisabled = function logDisabled(json, key) {
|
|
|
839
811
|
if (value != null) {
|
|
840
812
|
logger.debug(
|
|
841
813
|
'Server-side configuration of %s is currently disabled by local configuration. ' +
|
|
842
|
-
|
|
814
|
+
'(Server sent value of %s.)',
|
|
843
815
|
key,
|
|
844
816
|
value
|
|
845
817
|
)
|
|
@@ -858,7 +830,7 @@ Config.prototype.logUnsupported = function logUnsupported(json, key) {
|
|
|
858
830
|
if (value !== null && value !== undefined) {
|
|
859
831
|
logger.debug(
|
|
860
832
|
'Server-side configuration of %s is currently not supported by the ' +
|
|
861
|
-
|
|
833
|
+
'Node.js agent. (Server sent value of %s.)',
|
|
862
834
|
key,
|
|
863
835
|
value
|
|
864
836
|
)
|
|
@@ -874,21 +846,14 @@ Config.prototype.logUnsupported = function logUnsupported(json, key) {
|
|
|
874
846
|
*/
|
|
875
847
|
Config.prototype.logUnknown = function logUnknown(json, key) {
|
|
876
848
|
var value = json[key]
|
|
877
|
-
logger.debug(
|
|
878
|
-
'New Relic sent unknown configuration parameter %s with value %s.',
|
|
879
|
-
key,
|
|
880
|
-
value
|
|
881
|
-
)
|
|
849
|
+
logger.debug('New Relic sent unknown configuration parameter %s with value %s.', key, value)
|
|
882
850
|
}
|
|
883
851
|
|
|
884
852
|
/**
|
|
885
853
|
* Return the availability of async_hook for use by the agent.
|
|
886
854
|
*/
|
|
887
855
|
Config.prototype.checkAsyncHookStatus = function checkAsyncHookStatus() {
|
|
888
|
-
return
|
|
889
|
-
this.feature_flag.await_support &&
|
|
890
|
-
(psemver.satisfies('>=8') || psemver.prerelease())
|
|
891
|
-
)
|
|
856
|
+
return this.feature_flag.await_support
|
|
892
857
|
}
|
|
893
858
|
|
|
894
859
|
/**
|
|
@@ -949,7 +914,9 @@ Config.prototype.getIPAddresses = function getIPAddresses() {
|
|
|
949
914
|
var interfaces = os.networkInterfaces()
|
|
950
915
|
|
|
951
916
|
for (var interfaceKey in interfaces) {
|
|
952
|
-
if (interfaceKey.match(/^lo/))
|
|
917
|
+
if (interfaceKey.match(/^lo/)) {
|
|
918
|
+
continue
|
|
919
|
+
}
|
|
953
920
|
|
|
954
921
|
var interfaceDescriptions = interfaces[interfaceKey]
|
|
955
922
|
for (var i = 0; i < interfaceDescriptions.length; i++) {
|
|
@@ -1013,12 +980,18 @@ Config.prototype.applications = function applications() {
|
|
|
1013
980
|
* @param {object} internal Whichever chunk of the config being overridden.
|
|
1014
981
|
*/
|
|
1015
982
|
Config.prototype._fromPassed = function _fromPassed(external, internal, arbitrary) {
|
|
1016
|
-
if (!external)
|
|
1017
|
-
|
|
983
|
+
if (!external) {
|
|
984
|
+
return
|
|
985
|
+
}
|
|
986
|
+
if (!internal) {
|
|
987
|
+
internal = this
|
|
988
|
+
}
|
|
1018
989
|
|
|
1019
990
|
Object.keys(external).forEach(function overwrite(key) {
|
|
1020
991
|
// if it's not in the defaults, it doesn't exist
|
|
1021
|
-
if (!arbitrary && internal[key] === undefined)
|
|
992
|
+
if (!arbitrary && internal[key] === undefined) {
|
|
993
|
+
return
|
|
994
|
+
}
|
|
1022
995
|
|
|
1023
996
|
if (key === 'ssl' && !isTruthular(external.ssl)) {
|
|
1024
997
|
logger.warn('SSL config key can no longer be disabled, not updating.')
|
|
@@ -1052,10 +1025,16 @@ Config.prototype._fromPassed = function _fromPassed(external, internal, arbitrar
|
|
|
1052
1025
|
*/
|
|
1053
1026
|
Config.prototype._fromSpecial = function _fromSpecial() {
|
|
1054
1027
|
var name = this.app_name
|
|
1055
|
-
if (
|
|
1056
|
-
|
|
1028
|
+
if (
|
|
1029
|
+
name === null ||
|
|
1030
|
+
name === undefined ||
|
|
1031
|
+
name === '' ||
|
|
1032
|
+
(Array.isArray(name) && name.length === 0)
|
|
1033
|
+
) {
|
|
1057
1034
|
var azureName = process.env[AZURE_APP_NAME]
|
|
1058
|
-
if (azureName)
|
|
1035
|
+
if (azureName) {
|
|
1036
|
+
this.app_name = azureName.split(',')
|
|
1037
|
+
}
|
|
1059
1038
|
}
|
|
1060
1039
|
}
|
|
1061
1040
|
|
|
@@ -1064,7 +1043,7 @@ Config.prototype._fromSpecial = function _fromSpecial() {
|
|
|
1064
1043
|
* (of the form NEW_RELIC_FEATURE_FLAG_<feature flag name in upper case>).
|
|
1065
1044
|
*/
|
|
1066
1045
|
Config.prototype._featureFlagsFromEnv = function _featureFlagsFromEnv() {
|
|
1067
|
-
const flags = Object.keys(
|
|
1046
|
+
const flags = Object.keys(featureFlag.prerelease).concat(featureFlag.released)
|
|
1068
1047
|
const config = this
|
|
1069
1048
|
flags.forEach(function checkFlag(flag) {
|
|
1070
1049
|
const envVal = process.env['NEW_RELIC_FEATURE_FLAG_' + flag.toUpperCase()]
|
|
@@ -1085,8 +1064,12 @@ Config.prototype._featureFlagsFromEnv = function _featureFlagsFromEnv() {
|
|
|
1085
1064
|
* never need to set this yourself.
|
|
1086
1065
|
*/
|
|
1087
1066
|
Config.prototype._fromEnvironment = function _fromEnvironment(metadata, data) {
|
|
1088
|
-
if (!metadata)
|
|
1089
|
-
|
|
1067
|
+
if (!metadata) {
|
|
1068
|
+
metadata = ENV.ENV_MAPPING
|
|
1069
|
+
}
|
|
1070
|
+
if (!data) {
|
|
1071
|
+
data = this
|
|
1072
|
+
}
|
|
1090
1073
|
|
|
1091
1074
|
Object.keys(metadata).forEach(function applyEnvDefault(value) {
|
|
1092
1075
|
// if it's not in the config, it doesn't exist
|
|
@@ -1123,7 +1106,9 @@ Config.prototype._fromEnvironment = function _fromEnvironment(metadata, data) {
|
|
|
1123
1106
|
}
|
|
1124
1107
|
} else {
|
|
1125
1108
|
// don't crash if the mapping has config keys the current config doesn't.
|
|
1126
|
-
if (!data[value])
|
|
1109
|
+
if (!data[value]) {
|
|
1110
|
+
data[value] = Object.create(null)
|
|
1111
|
+
}
|
|
1127
1112
|
this._fromEnvironment(node, data[value])
|
|
1128
1113
|
}
|
|
1129
1114
|
}, this)
|
|
@@ -1141,7 +1126,7 @@ Config.prototype._loggingManuallySet = function _loggingManuallySet(inputConfig)
|
|
|
1141
1126
|
const inputEnabled = inputConfig && inputConfig.logging && inputConfig.logging.enabled
|
|
1142
1127
|
const envEnabled = process.env.NEW_RELIC_LOG_ENABLED
|
|
1143
1128
|
|
|
1144
|
-
return
|
|
1129
|
+
return inputEnabled !== undefined || envEnabled !== undefined
|
|
1145
1130
|
}
|
|
1146
1131
|
|
|
1147
1132
|
/**
|
|
@@ -1152,16 +1137,16 @@ Config.prototype._loggingManuallySet = function _loggingManuallySet(inputConfig)
|
|
|
1152
1137
|
*
|
|
1153
1138
|
* @returns {boolean}
|
|
1154
1139
|
*/
|
|
1155
|
-
Config.prototype._nativeMetricsManuallySet =
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1140
|
+
Config.prototype._nativeMetricsManuallySet = function _nativeMetricsManuallySet(inputConfig) {
|
|
1141
|
+
const inputEnabled =
|
|
1142
|
+
inputConfig &&
|
|
1143
|
+
inputConfig.plugins &&
|
|
1144
|
+
inputConfig.plugins.native_metrics &&
|
|
1145
|
+
inputConfig.plugins.native_metrics.enabled
|
|
1146
|
+
const envEnabled = process.env.NEW_RELIC_NATIVE_METRICS_ENABLED
|
|
1147
|
+
|
|
1148
|
+
return inputEnabled !== undefined || envEnabled !== undefined
|
|
1149
|
+
}
|
|
1165
1150
|
|
|
1166
1151
|
/**
|
|
1167
1152
|
* Returns true if distributed tracing has been manually enabled via configuration file or
|
|
@@ -1172,13 +1157,12 @@ Config.prototype._nativeMetricsManuallySet =
|
|
|
1172
1157
|
* @returns {boolean}
|
|
1173
1158
|
*/
|
|
1174
1159
|
Config.prototype._DTManuallySet = function _DTManuallySet(inputConfig) {
|
|
1175
|
-
const inputEnabled =
|
|
1176
|
-
|
|
1177
|
-
&& inputConfig.distributed_tracing.enabled
|
|
1160
|
+
const inputEnabled =
|
|
1161
|
+
inputConfig && inputConfig.distributed_tracing && inputConfig.distributed_tracing.enabled
|
|
1178
1162
|
|
|
1179
1163
|
const envEnabled = process.env.NEW_RELIC_DISTRIBUTED_TRACING_ENABLED
|
|
1180
1164
|
|
|
1181
|
-
return
|
|
1165
|
+
return inputEnabled !== undefined || envEnabled !== undefined
|
|
1182
1166
|
}
|
|
1183
1167
|
|
|
1184
1168
|
/**
|
|
@@ -1201,7 +1185,7 @@ Config.prototype._enforceServerless = function _enforceServerless(inputConfig) {
|
|
|
1201
1185
|
const name = process.env.AWS_LAMBDA_FUNCTION_NAME || 'Serverless Application'
|
|
1202
1186
|
this.app_name = [name]
|
|
1203
1187
|
|
|
1204
|
-
logger.info(
|
|
1188
|
+
logger.info("Auto-naming serverless application to ['%s'] from: %s", name, namingSource)
|
|
1205
1189
|
}
|
|
1206
1190
|
|
|
1207
1191
|
// Explicitly disable old CAT in serverless_mode
|
|
@@ -1221,26 +1205,25 @@ Config.prototype._enforceServerless = function _enforceServerless(inputConfig) {
|
|
|
1221
1205
|
|
|
1222
1206
|
logger.info(
|
|
1223
1207
|
'Logging is disabled by default when serverless_mode is enabled. ' +
|
|
1224
|
-
|
|
1225
|
-
|
|
1208
|
+
'If desired, enable logging via config file or environment variable and ' +
|
|
1209
|
+
'set filepath to a valid path for current environment, stdout or stderr.'
|
|
1226
1210
|
)
|
|
1227
1211
|
}
|
|
1228
1212
|
|
|
1229
|
-
if (this._nativeMetricsManuallySet(inputConfig) &&
|
|
1230
|
-
this.plugins.native_metrics.enabled) {
|
|
1213
|
+
if (this._nativeMetricsManuallySet(inputConfig) && this.plugins.native_metrics.enabled) {
|
|
1231
1214
|
logger.info(
|
|
1232
1215
|
'Enabling the native-metrics module when in serverless mode may greatly ' +
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1216
|
+
'increase cold-start times. Given the limited benefit of the VM metrics' +
|
|
1217
|
+
'and general lack of control in a serverless environment, we do not ' +
|
|
1218
|
+
'recommend this trade-off.'
|
|
1236
1219
|
)
|
|
1237
1220
|
} else {
|
|
1238
1221
|
this.plugins.native_metrics.enabled = false
|
|
1239
1222
|
|
|
1240
1223
|
logger.info(
|
|
1241
1224
|
'The native-metrics module is disabled by default when serverless_mode ' +
|
|
1242
|
-
|
|
1243
|
-
|
|
1225
|
+
'is enabled. If desired, enable the native-metrics module via config file ' +
|
|
1226
|
+
'or environment variable.'
|
|
1244
1227
|
)
|
|
1245
1228
|
}
|
|
1246
1229
|
|
|
@@ -1252,8 +1235,8 @@ Config.prototype._enforceServerless = function _enforceServerless(inputConfig) {
|
|
|
1252
1235
|
if (this.distributed_tracing.enabled) {
|
|
1253
1236
|
logger.warn(
|
|
1254
1237
|
'Using distributed tracing in serverless mode requires account_id be ' +
|
|
1255
|
-
|
|
1256
|
-
|
|
1238
|
+
'defined, either in your newrelic.js file or via environment variables. ' +
|
|
1239
|
+
'Disabling distributed tracing.'
|
|
1257
1240
|
)
|
|
1258
1241
|
this.distributed_tracing.enabled = false
|
|
1259
1242
|
}
|
|
@@ -1274,8 +1257,9 @@ Config.prototype._enforceServerless = function _enforceServerless(inputConfig) {
|
|
|
1274
1257
|
DT_KEYS.forEach((key) => {
|
|
1275
1258
|
if (this[key]) {
|
|
1276
1259
|
logger.warn(
|
|
1277
|
-
key +
|
|
1278
|
-
|
|
1260
|
+
key +
|
|
1261
|
+
' was configured locally without enabling serverless_mode. ' +
|
|
1262
|
+
'This local value will be ignored and set by the New Relic servers.'
|
|
1279
1263
|
)
|
|
1280
1264
|
this[key] = null
|
|
1281
1265
|
}
|
|
@@ -1321,14 +1305,11 @@ Config.prototype._canonicalize = function _canonicalize() {
|
|
|
1321
1305
|
logger.warnOnce(
|
|
1322
1306
|
'IgnoreServerConfigurationWarning',
|
|
1323
1307
|
'The local config setting `ignore_server_configuration` has been deprecated ' +
|
|
1324
|
-
|
|
1325
|
-
|
|
1308
|
+
'and removed as of Agent v5. Please review agent documentation or contact ' +
|
|
1309
|
+
'New Relic support.'
|
|
1326
1310
|
)
|
|
1327
1311
|
}
|
|
1328
1312
|
|
|
1329
|
-
this.serverless_mode.enabled = this.serverless_mode.enabled
|
|
1330
|
-
&& this.feature_flag.serverless_mode
|
|
1331
|
-
|
|
1332
1313
|
if (this.license_key) {
|
|
1333
1314
|
this.license_key = this.license_key.trim()
|
|
1334
1315
|
}
|
|
@@ -1342,7 +1323,8 @@ function _parseCodes(codes) {
|
|
|
1342
1323
|
logger.warn('Failed to parse range %s', range)
|
|
1343
1324
|
return parsed
|
|
1344
1325
|
}
|
|
1345
|
-
if (split[0] === '') {
|
|
1326
|
+
if (split[0] === '') {
|
|
1327
|
+
// catch negative code. ex. -7
|
|
1346
1328
|
return parsed.push(parseInt(range, 10))
|
|
1347
1329
|
}
|
|
1348
1330
|
var lower = parseInt(split[0], 10)
|
|
@@ -1355,7 +1337,8 @@ function _parseCodes(codes) {
|
|
|
1355
1337
|
logger.warn('Range must start with lower bound %s', range)
|
|
1356
1338
|
} else if (lower < 0 || upper > 1000) {
|
|
1357
1339
|
logger.warn('Range must be between 0 and 1000 %s', range)
|
|
1358
|
-
} else {
|
|
1340
|
+
} else {
|
|
1341
|
+
// success
|
|
1359
1342
|
for (var i = lower; i <= upper; i++) {
|
|
1360
1343
|
parsed.push(i)
|
|
1361
1344
|
}
|
|
@@ -1402,11 +1385,7 @@ Config.prototype._applyHighSecurity = function _applyHighSecurity() {
|
|
|
1402
1385
|
|
|
1403
1386
|
if (hsValue && typeof hsValue === 'object' && !(hsValue instanceof Array)) {
|
|
1404
1387
|
if (typeof target[key] !== 'object') {
|
|
1405
|
-
logger.warn(
|
|
1406
|
-
'High Security Mode: %s should be an object, found %s',
|
|
1407
|
-
key,
|
|
1408
|
-
target[key]
|
|
1409
|
-
)
|
|
1388
|
+
logger.warn('High Security Mode: %s should be an object, found %s', key, target[key])
|
|
1410
1389
|
target[key] = Object.create(null)
|
|
1411
1390
|
}
|
|
1412
1391
|
|
|
@@ -1414,12 +1393,7 @@ Config.prototype._applyHighSecurity = function _applyHighSecurity() {
|
|
|
1414
1393
|
}
|
|
1415
1394
|
|
|
1416
1395
|
if (target[key] !== hsValue) {
|
|
1417
|
-
logger.warn(
|
|
1418
|
-
'High Security Mode: %s was set to %s, coercing to %s',
|
|
1419
|
-
key,
|
|
1420
|
-
target[key],
|
|
1421
|
-
hsValue
|
|
1422
|
-
)
|
|
1396
|
+
logger.warn('High Security Mode: %s was set to %s, coercing to %s', key, target[key], hsValue)
|
|
1423
1397
|
target[key] = hsValue
|
|
1424
1398
|
config.emit(base + key, hsValue)
|
|
1425
1399
|
}
|
|
@@ -1481,11 +1455,11 @@ Config.prototype.applyLasp = function applyLasp(agent, policies) {
|
|
|
1481
1455
|
var policyValue = policyValues[policy.enabled ? 1 : 0]
|
|
1482
1456
|
|
|
1483
1457
|
// get the most secure setting between local config and the policy
|
|
1484
|
-
var finalValue = settingBlock[valueName] = config._getMostSecure(
|
|
1458
|
+
var finalValue = (settingBlock[valueName] = config._getMostSecure(
|
|
1485
1459
|
name,
|
|
1486
1460
|
localVal,
|
|
1487
1461
|
policyValue
|
|
1488
|
-
)
|
|
1462
|
+
))
|
|
1489
1463
|
policy.enabled = policyValues.indexOf(finalValue) === 1
|
|
1490
1464
|
obj[name] = policy
|
|
1491
1465
|
|
|
@@ -1514,11 +1488,14 @@ Config.prototype.applyLasp = function applyLasp(agent, policies) {
|
|
|
1514
1488
|
if (missingLASP.length) {
|
|
1515
1489
|
fatalMessage =
|
|
1516
1490
|
'The agent did not receive one or more security policies that it ' +
|
|
1517
|
-
'expected and will shut down: ' +
|
|
1491
|
+
'expected and will shut down: ' +
|
|
1492
|
+
missingLASP.join(', ') +
|
|
1493
|
+
'.'
|
|
1518
1494
|
} else if (missingRequired.length) {
|
|
1519
1495
|
fatalMessage =
|
|
1520
1496
|
'The agent received one or more required security policies that it ' +
|
|
1521
|
-
'does not recognize and will shut down: ' +
|
|
1497
|
+
'does not recognize and will shut down: ' +
|
|
1498
|
+
missingRequired.join(', ') +
|
|
1522
1499
|
'. Please check if a newer agent version supports these policies ' +
|
|
1523
1500
|
'or contact support.'
|
|
1524
1501
|
}
|
|
@@ -1533,10 +1510,10 @@ Config.prototype.applyLasp = function applyLasp(agent, policies) {
|
|
|
1533
1510
|
|
|
1534
1511
|
Config.prototype.validateFlags = function validateFlags() {
|
|
1535
1512
|
Object.keys(this.feature_flag).forEach(function forEachFlag(key) {
|
|
1536
|
-
if (
|
|
1513
|
+
if (featureFlag.released.indexOf(key) > -1) {
|
|
1537
1514
|
logger.warn('Feature flag %s has been released', key)
|
|
1538
1515
|
}
|
|
1539
|
-
if (
|
|
1516
|
+
if (featureFlag.unreleased.indexOf(key) > -1) {
|
|
1540
1517
|
logger.warn('Feature flag %s has been deprecated', key)
|
|
1541
1518
|
}
|
|
1542
1519
|
})
|
|
@@ -1633,7 +1610,9 @@ function initialize(config) {
|
|
|
1633
1610
|
*/
|
|
1634
1611
|
logger = require('../logger')
|
|
1635
1612
|
|
|
1636
|
-
if (config)
|
|
1613
|
+
if (config) {
|
|
1614
|
+
return new Config(config)
|
|
1615
|
+
}
|
|
1637
1616
|
|
|
1638
1617
|
if (isTruthular(process.env.NEW_RELIC_NO_CONFIG_FILE)) {
|
|
1639
1618
|
logger.info('NEW_RELIC_NO_CONFIG_FILE set, deferring to environment variables.')
|
|
@@ -1643,13 +1622,16 @@ function initialize(config) {
|
|
|
1643
1622
|
|
|
1644
1623
|
var filepath = _findConfigFile()
|
|
1645
1624
|
if (!filepath) {
|
|
1646
|
-
logger.info(
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1625
|
+
logger.info(
|
|
1626
|
+
[
|
|
1627
|
+
'Unable to find configuration file.',
|
|
1628
|
+
'If a configuration file is desired (common for non-containerized environments),',
|
|
1629
|
+
`a base configuration file can be copied from ${BASE_CONFIG_PATH}`,
|
|
1630
|
+
'and renamed to "newrelic.js" in the directory from which you will start',
|
|
1631
|
+
'your application.',
|
|
1632
|
+
'Attempting to start agent using environment variables.'
|
|
1633
|
+
].join(' ')
|
|
1634
|
+
)
|
|
1653
1635
|
|
|
1654
1636
|
return createNewConfigObject(config)
|
|
1655
1637
|
}
|
|
@@ -1660,12 +1642,14 @@ function initialize(config) {
|
|
|
1660
1642
|
} catch (error) {
|
|
1661
1643
|
logger.error(error)
|
|
1662
1644
|
|
|
1663
|
-
logger.warn(
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1645
|
+
logger.warn(
|
|
1646
|
+
[
|
|
1647
|
+
`Unable to read existing configuration file "${filepath}".`,
|
|
1648
|
+
'To allow reading of the file (if desired),',
|
|
1649
|
+
'please ensure the application has read access and the file is exporting valid JSON.',
|
|
1650
|
+
'Attempting to start agent using enviornment variables.'
|
|
1651
|
+
].join(' ')
|
|
1652
|
+
)
|
|
1669
1653
|
}
|
|
1670
1654
|
|
|
1671
1655
|
if (!userConf) {
|
|
@@ -1686,7 +1670,9 @@ function initialize(config) {
|
|
|
1686
1670
|
*/
|
|
1687
1671
|
function createNewConfigObject(config) {
|
|
1688
1672
|
config = new Config(Object.create(null))
|
|
1689
|
-
if (config.newrelic_home)
|
|
1673
|
+
if (config.newrelic_home) {
|
|
1674
|
+
delete config.newrelic_home
|
|
1675
|
+
}
|
|
1690
1676
|
return config
|
|
1691
1677
|
}
|
|
1692
1678
|
|
|
@@ -1707,7 +1693,7 @@ function getOrCreateInstance() {
|
|
|
1707
1693
|
|
|
1708
1694
|
// Config construction has potential to throw due to invalid settings.
|
|
1709
1695
|
// This allows the agent to return a stub api without crashing the process.
|
|
1710
|
-
_configInstance = Object.assign(defaultConfig(), {agent_enabled: false})
|
|
1696
|
+
_configInstance = Object.assign(defaultConfig(), { agent_enabled: false })
|
|
1711
1697
|
_configInstance.setLogger = Config.prototype.setLogger
|
|
1712
1698
|
}
|
|
1713
1699
|
}
|
|
@@ -1723,8 +1709,6 @@ function createInstance(config) {
|
|
|
1723
1709
|
return _configInstance
|
|
1724
1710
|
}
|
|
1725
1711
|
|
|
1726
|
-
const REMOVE_BEFORE_SEND = new Set(['attributeFilter'])
|
|
1727
|
-
|
|
1728
1712
|
/**
|
|
1729
1713
|
* Preserve the legacy initializer, but also allow consumers to manage their
|
|
1730
1714
|
* own configuration if they choose.
|
|
@@ -1733,6 +1717,5 @@ Config.initialize = initialize
|
|
|
1733
1717
|
Config.getOrCreateInstance = getOrCreateInstance
|
|
1734
1718
|
Config.getInstance = getInstance
|
|
1735
1719
|
Config.createInstance = createInstance
|
|
1736
|
-
Config.SPAN_EVENT_LIMIT = SPAN_EVENT_LIMIT
|
|
1737
1720
|
|
|
1738
1721
|
module.exports = Config
|