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/environment.js
CHANGED
|
@@ -9,21 +9,20 @@ var a = require('async')
|
|
|
9
9
|
var path = require('path')
|
|
10
10
|
var fs = require('./util/unwrapped-core').fs
|
|
11
11
|
var os = require('os')
|
|
12
|
-
var logger = require('./logger').child({component: 'environment'})
|
|
12
|
+
var logger = require('./logger').child({ component: 'environment' })
|
|
13
13
|
var stringify = require('json-stringify-safe')
|
|
14
14
|
|
|
15
|
-
|
|
16
15
|
// As of 1.7.0 you can no longer dynamically link v8
|
|
17
16
|
// https://github.com/nodejs/io.js/commit/d726a177ed
|
|
18
17
|
var remapping = {
|
|
19
|
-
node_install_npm:
|
|
20
|
-
node_install_waf:
|
|
21
|
-
node_use_openssl:
|
|
22
|
-
node_shared_openssl:
|
|
23
|
-
node_shared_v8:
|
|
24
|
-
node_shared_zlib:
|
|
25
|
-
node_use_dtrace:
|
|
26
|
-
node_use_etw:
|
|
18
|
+
node_install_npm: 'npm installed?',
|
|
19
|
+
node_install_waf: 'WAF build system installed?',
|
|
20
|
+
node_use_openssl: 'OpenSSL support?',
|
|
21
|
+
node_shared_openssl: 'Dynamically linked to OpenSSL?',
|
|
22
|
+
node_shared_v8: 'Dynamically linked to V8?',
|
|
23
|
+
node_shared_zlib: 'Dynamically linked to Zlib?',
|
|
24
|
+
node_use_dtrace: 'DTrace support?',
|
|
25
|
+
node_use_etw: 'Event Tracing for Windows (ETW) support?'
|
|
27
26
|
}
|
|
28
27
|
|
|
29
28
|
var settings = Object.create(null)
|
|
@@ -80,19 +79,22 @@ function listPackages(root, packages, callback) {
|
|
|
80
79
|
}
|
|
81
80
|
_log('Listing packages in %s', root)
|
|
82
81
|
|
|
83
|
-
a.waterfall(
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
82
|
+
a.waterfall(
|
|
83
|
+
[
|
|
84
|
+
a.apply(fs.readdir, root),
|
|
85
|
+
function iterateDirs(dirs, cb) {
|
|
86
|
+
a.eachLimit(dirs, 2, forEachDir, cb)
|
|
87
|
+
}
|
|
88
|
+
],
|
|
89
|
+
function onAllDirsRead(err) {
|
|
90
|
+
_log('Done listing packages in %s', root)
|
|
91
|
+
if (err) {
|
|
92
|
+
logger.trace(err, 'Could not list packages in %s (probably not an error)', root)
|
|
93
|
+
return callback()
|
|
94
|
+
}
|
|
95
|
+
callback(null, packages)
|
|
93
96
|
}
|
|
94
|
-
|
|
95
|
-
})
|
|
97
|
+
)
|
|
96
98
|
|
|
97
99
|
function forEachDir(dir, cb) {
|
|
98
100
|
_log('Checking package %s in %s', dir, root)
|
|
@@ -164,19 +166,22 @@ function listDependencies(root, children, visited, callback) {
|
|
|
164
166
|
}
|
|
165
167
|
_log('Listing dependencies in %s', root)
|
|
166
168
|
|
|
167
|
-
a.waterfall(
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
169
|
+
a.waterfall(
|
|
170
|
+
[
|
|
171
|
+
a.apply(fs.readdir, root),
|
|
172
|
+
function iterateDirs(dirs, cb) {
|
|
173
|
+
a.eachLimit(dirs, 2, forEachEntry, cb)
|
|
174
|
+
}
|
|
175
|
+
],
|
|
176
|
+
function onAllDirsRead(err) {
|
|
177
|
+
_log('Done listing dependencies in %s', root)
|
|
178
|
+
if (err) {
|
|
179
|
+
logger.trace(err, 'Could not read directories in %s (probably not an error)', root)
|
|
180
|
+
return callback()
|
|
181
|
+
}
|
|
182
|
+
callback(null, children)
|
|
177
183
|
}
|
|
178
|
-
|
|
179
|
-
})
|
|
184
|
+
)
|
|
180
185
|
|
|
181
186
|
function forEachEntry(entry, cb) {
|
|
182
187
|
_log('Checking dependencies in %s (%s)', entry, root)
|
|
@@ -201,16 +206,19 @@ function listDependencies(root, children, visited, callback) {
|
|
|
201
206
|
visited[realCandidate] = true
|
|
202
207
|
|
|
203
208
|
// Load the packages and dependencies for this directory.
|
|
204
|
-
a.series(
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
209
|
+
a.series(
|
|
210
|
+
[
|
|
211
|
+
a.apply(listPackages, realCandidate, children),
|
|
212
|
+
a.apply(listDependencies, realCandidate, children, visited)
|
|
213
|
+
],
|
|
214
|
+
function onRecurseListComplete(loadErr) {
|
|
215
|
+
_log('Done with dependencies in %s', realCandidate)
|
|
216
|
+
if (loadErr) {
|
|
217
|
+
logger.debug(loadErr, 'Failed to list dependencies in %s', realCandidate)
|
|
218
|
+
}
|
|
219
|
+
cb()
|
|
211
220
|
}
|
|
212
|
-
|
|
213
|
-
})
|
|
221
|
+
)
|
|
214
222
|
})
|
|
215
223
|
}
|
|
216
224
|
}
|
|
@@ -228,31 +236,38 @@ function getLocalPackages(callback) {
|
|
|
228
236
|
var visited = Object.create(null)
|
|
229
237
|
_log('Getting local packages')
|
|
230
238
|
|
|
231
|
-
a.whilst(
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
a.
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
239
|
+
a.whilst(
|
|
240
|
+
function checkCandidate(cb) {
|
|
241
|
+
return cb(null, candidate)
|
|
242
|
+
},
|
|
243
|
+
function iterate(cb) {
|
|
244
|
+
_log('Checking for local packages in %s', candidate)
|
|
245
|
+
var root = path.resolve(candidate, 'node_modules')
|
|
246
|
+
a.series(
|
|
247
|
+
[
|
|
248
|
+
a.apply(listPackages, root, packages),
|
|
249
|
+
a.apply(listDependencies, root, dependencies, visited)
|
|
250
|
+
],
|
|
251
|
+
function onListComplete(err) {
|
|
252
|
+
_log('Done checking for local packages in %s', candidate)
|
|
253
|
+
var last = candidate
|
|
254
|
+
candidate = path.dirname(candidate)
|
|
255
|
+
if (last === candidate) {
|
|
256
|
+
candidate = null
|
|
257
|
+
}
|
|
258
|
+
cb(err)
|
|
259
|
+
}
|
|
260
|
+
)
|
|
261
|
+
},
|
|
262
|
+
function whileComplete(err) {
|
|
263
|
+
_log('Done getting local packages')
|
|
264
|
+
if (err) {
|
|
265
|
+
callback(err)
|
|
266
|
+
} else {
|
|
267
|
+
callback(null, { packages: packages, dependencies: dependencies })
|
|
245
268
|
}
|
|
246
|
-
cb(err)
|
|
247
|
-
})
|
|
248
|
-
}, function whileComplete(err) {
|
|
249
|
-
_log('Done getting local packages')
|
|
250
|
-
if (err) {
|
|
251
|
-
callback(err)
|
|
252
|
-
} else {
|
|
253
|
-
callback(null, {packages: packages, dependencies: dependencies})
|
|
254
269
|
}
|
|
255
|
-
|
|
270
|
+
)
|
|
256
271
|
}
|
|
257
272
|
|
|
258
273
|
/**
|
|
@@ -269,17 +284,17 @@ function getPackages(root, cb) {
|
|
|
269
284
|
var dependencies = []
|
|
270
285
|
_log('Getting packages from %s', root)
|
|
271
286
|
|
|
272
|
-
a.series(
|
|
273
|
-
a.apply(listPackages, root, packages),
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
287
|
+
a.series(
|
|
288
|
+
[a.apply(listPackages, root, packages), a.apply(listDependencies, root, dependencies)],
|
|
289
|
+
function onListComplete(err) {
|
|
290
|
+
_log('Done getting packages from %s', root)
|
|
291
|
+
if (err) {
|
|
292
|
+
cb(err)
|
|
293
|
+
} else {
|
|
294
|
+
cb(null, { packages: packages, dependencies: dependencies })
|
|
295
|
+
}
|
|
281
296
|
}
|
|
282
|
-
|
|
297
|
+
)
|
|
283
298
|
}
|
|
284
299
|
|
|
285
300
|
/**
|
|
@@ -301,7 +316,7 @@ function getGlobalPackages(cb) {
|
|
|
301
316
|
}
|
|
302
317
|
|
|
303
318
|
_log('No global packages to get')
|
|
304
|
-
setImmediate(cb, null, {packages: [], dependencies: []})
|
|
319
|
+
setImmediate(cb, null, { packages: [], dependencies: [] })
|
|
305
320
|
}
|
|
306
321
|
|
|
307
322
|
/**
|
|
@@ -314,23 +329,23 @@ function getGlobalPackages(cb) {
|
|
|
314
329
|
*/
|
|
315
330
|
function flattenVersions(packages) {
|
|
316
331
|
var info = Object.create(null)
|
|
317
|
-
packages.forEach(
|
|
332
|
+
packages.forEach((pair) => {
|
|
318
333
|
var p = pair[0]
|
|
319
334
|
var v = pair[1]
|
|
320
335
|
|
|
321
336
|
if (info[p]) {
|
|
322
|
-
if (info[p].indexOf(v) < 0)
|
|
337
|
+
if (info[p].indexOf(v) < 0) {
|
|
338
|
+
info[p].push(v)
|
|
339
|
+
}
|
|
323
340
|
} else {
|
|
324
341
|
info[p] = [v]
|
|
325
342
|
}
|
|
326
343
|
})
|
|
327
344
|
|
|
328
345
|
return Object.keys(info)
|
|
329
|
-
.map(
|
|
330
|
-
return [key, info[key].join(', ')]
|
|
331
|
-
})
|
|
346
|
+
.map((key) => [key, info[key].join(', ')])
|
|
332
347
|
.sort()
|
|
333
|
-
.map(
|
|
348
|
+
.map((pair) => {
|
|
334
349
|
try {
|
|
335
350
|
return stringify(pair)
|
|
336
351
|
} catch (err) {
|
|
@@ -351,12 +366,16 @@ function flattenVersions(packages) {
|
|
|
351
366
|
function remapConfigSettings() {
|
|
352
367
|
if (process.config && process.config.variables) {
|
|
353
368
|
var variables = process.config.variables
|
|
354
|
-
Object.keys(variables).forEach(
|
|
369
|
+
Object.keys(variables).forEach((key) => {
|
|
355
370
|
if (remapping[key]) {
|
|
356
371
|
var value = variables[key]
|
|
357
372
|
|
|
358
|
-
if (value === true || value === 1)
|
|
359
|
-
|
|
373
|
+
if (value === true || value === 1) {
|
|
374
|
+
value = 'yes'
|
|
375
|
+
}
|
|
376
|
+
if (value === false || value === 0) {
|
|
377
|
+
value = 'no'
|
|
378
|
+
}
|
|
360
379
|
|
|
361
380
|
addSetting(remapping[key], value)
|
|
362
381
|
}
|
|
@@ -366,35 +385,43 @@ function remapConfigSettings() {
|
|
|
366
385
|
|
|
367
386
|
function getOtherPackages(callback) {
|
|
368
387
|
_log('Getting other packages')
|
|
369
|
-
var other = {packages: [], dependencies: []}
|
|
388
|
+
var other = { packages: [], dependencies: [] }
|
|
370
389
|
|
|
371
390
|
if (!process.env.NODE_PATH) {
|
|
372
391
|
return callback(null, other)
|
|
373
392
|
}
|
|
374
393
|
|
|
375
394
|
var paths
|
|
376
|
-
if (process.platform === 'win32') {
|
|
395
|
+
if (process.platform === 'win32') {
|
|
396
|
+
// why. WHY.
|
|
377
397
|
paths = process.env.NODE_PATH.split(';')
|
|
378
398
|
} else {
|
|
379
399
|
paths = process.env.NODE_PATH.split(':')
|
|
380
400
|
}
|
|
381
401
|
_log('Looking for other packages in %j', paths)
|
|
382
402
|
|
|
383
|
-
a.eachLimit(
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
other.packages.push.apply(other.packages, nextSet.packages)
|
|
390
|
-
other.dependencies.push.apply(other.dependencies, nextSet.dependencies)
|
|
403
|
+
a.eachLimit(
|
|
404
|
+
paths,
|
|
405
|
+
2,
|
|
406
|
+
function listEachOtherPackage(nodePath, cb) {
|
|
407
|
+
if (nodePath[0] !== '/') {
|
|
408
|
+
nodePath = path.resolve(process.cwd(), nodePath)
|
|
391
409
|
}
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
410
|
+
_log('Getting other packages from %s', nodePath)
|
|
411
|
+
getPackages(nodePath, function onGetPackageFinish(err, nextSet) {
|
|
412
|
+
_log('Done getting other packages from %s', nodePath)
|
|
413
|
+
if (!err && nextSet) {
|
|
414
|
+
other.packages.push.apply(other.packages, nextSet.packages)
|
|
415
|
+
other.dependencies.push.apply(other.dependencies, nextSet.dependencies)
|
|
416
|
+
}
|
|
417
|
+
cb(err)
|
|
418
|
+
})
|
|
419
|
+
},
|
|
420
|
+
function onOtherFinish(err) {
|
|
421
|
+
_log('Done getting other packages')
|
|
422
|
+
callback(err, other)
|
|
423
|
+
}
|
|
424
|
+
)
|
|
398
425
|
}
|
|
399
426
|
|
|
400
427
|
function getHomePackages(cb) {
|
|
@@ -412,13 +439,17 @@ function getHomePackages(cb) {
|
|
|
412
439
|
return cb(null, null)
|
|
413
440
|
}
|
|
414
441
|
|
|
415
|
-
a.mapSeries(
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
442
|
+
a.mapSeries(
|
|
443
|
+
{
|
|
444
|
+
home: path.resolve(homeDir, '.node_modules'),
|
|
445
|
+
homeOld: path.resolve(homeDir, '.node_libraries')
|
|
446
|
+
},
|
|
447
|
+
getPackages,
|
|
448
|
+
function onHomeFinish(err, packages) {
|
|
449
|
+
_log('Done getting home packages from %s', homeDir)
|
|
450
|
+
cb(err, packages)
|
|
451
|
+
}
|
|
452
|
+
)
|
|
422
453
|
}
|
|
423
454
|
|
|
424
455
|
/**
|
|
@@ -432,40 +463,44 @@ function getHomePackages(cb) {
|
|
|
432
463
|
*/
|
|
433
464
|
function findPackages(cb) {
|
|
434
465
|
_log('Finding all packages')
|
|
435
|
-
a.parallelLimit(
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
466
|
+
a.parallelLimit(
|
|
467
|
+
{
|
|
468
|
+
local: time(getLocalPackages),
|
|
469
|
+
global: time(getGlobalPackages),
|
|
470
|
+
other: time(getOtherPackages),
|
|
471
|
+
home: time(getHomePackages)
|
|
472
|
+
},
|
|
473
|
+
2,
|
|
474
|
+
function onPackageComplete(err, data) {
|
|
475
|
+
_log('Done finding all packages')
|
|
476
|
+
if (err) {
|
|
477
|
+
return cb(err)
|
|
478
|
+
}
|
|
445
479
|
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
480
|
+
var packages = data.local.packages
|
|
481
|
+
packages.push.apply(packages, data.global.packages)
|
|
482
|
+
packages.push.apply(packages, data.other.packages)
|
|
449
483
|
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
484
|
+
var dependencies = data.local.dependencies
|
|
485
|
+
dependencies.push.apply(dependencies, data.global.dependencies)
|
|
486
|
+
dependencies.push.apply(dependencies, data.other.dependencies)
|
|
453
487
|
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
488
|
+
if (data.home) {
|
|
489
|
+
if (data.home.home) {
|
|
490
|
+
packages.unshift.apply(packages, data.home.home.packages)
|
|
491
|
+
dependencies.unshift.apply(dependencies, data.home.home.dependencies)
|
|
492
|
+
}
|
|
493
|
+
if (data.home.homeOld) {
|
|
494
|
+
packages.unshift.apply(packages, data.home.homeOld.packages)
|
|
495
|
+
dependencies.unshift.apply(dependencies, data.home.homeOld.dependencies)
|
|
496
|
+
}
|
|
462
497
|
}
|
|
463
|
-
}
|
|
464
498
|
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
499
|
+
addSetting('Packages', flattenVersions(packages))
|
|
500
|
+
addSetting('Dependencies', flattenVersions(dependencies))
|
|
501
|
+
cb()
|
|
502
|
+
}
|
|
503
|
+
)
|
|
469
504
|
}
|
|
470
505
|
|
|
471
506
|
function time(fn) {
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
const errorsModule = require('./index')
|
|
9
9
|
|
|
10
|
-
const logger = require('../logger').child({component: 'error_tracer'})
|
|
10
|
+
const logger = require('../logger').child({ component: 'error_tracer' })
|
|
11
11
|
const urltils = require('../util/urltils')
|
|
12
12
|
const Exception = require('../errors').Exception
|
|
13
13
|
const errorHelper = require('./helper')
|
|
@@ -34,10 +34,7 @@ class ErrorCollector {
|
|
|
34
34
|
this.seenObjectsByTransaction = Object.create(null)
|
|
35
35
|
this.seenStringsByTransaction = Object.create(null)
|
|
36
36
|
|
|
37
|
-
this.traceAggregator.on(
|
|
38
|
-
'starting error_data data send.',
|
|
39
|
-
this._onSendErrorTrace.bind(this)
|
|
40
|
-
)
|
|
37
|
+
this.traceAggregator.on('starting error_data data send.', this._onSendErrorTrace.bind(this))
|
|
41
38
|
}
|
|
42
39
|
|
|
43
40
|
_onSendErrorTrace() {
|
|
@@ -48,8 +45,7 @@ class ErrorCollector {
|
|
|
48
45
|
start() {
|
|
49
46
|
// TODO: Log? Return true/false?
|
|
50
47
|
|
|
51
|
-
const errorCollectorEnabled =
|
|
52
|
-
this.config.error_collector && this.config.error_collector.enabled
|
|
48
|
+
const errorCollectorEnabled = this.config.error_collector && this.config.error_collector.enabled
|
|
53
49
|
|
|
54
50
|
if (!errorCollectorEnabled) {
|
|
55
51
|
return
|
|
@@ -95,7 +91,8 @@ class ErrorCollector {
|
|
|
95
91
|
// of marking the exception as seen when we're just testing for if we've
|
|
96
92
|
// seen it!
|
|
97
93
|
seenObjects.add(exception)
|
|
98
|
-
} else {
|
|
94
|
+
} else {
|
|
95
|
+
// typeof exception !== 'object'
|
|
99
96
|
if (!this.seenStringsByTransaction[txId]) {
|
|
100
97
|
this.seenStringsByTransaction[txId] = Object.create(null)
|
|
101
98
|
}
|
|
@@ -119,7 +116,9 @@ class ErrorCollector {
|
|
|
119
116
|
* @return {number} The number of unexpected errors
|
|
120
117
|
*/
|
|
121
118
|
onTransactionFinished(transaction) {
|
|
122
|
-
if (!transaction)
|
|
119
|
+
if (!transaction) {
|
|
120
|
+
throw new Error('Error collector got a blank transaction.')
|
|
121
|
+
}
|
|
123
122
|
if (transaction.ignore) {
|
|
124
123
|
return
|
|
125
124
|
}
|
|
@@ -142,15 +141,9 @@ class ErrorCollector {
|
|
|
142
141
|
}
|
|
143
142
|
|
|
144
143
|
const isErroredTransaction = urltils.isError(this.config, transaction.statusCode)
|
|
145
|
-
const isIgnoredErrorStatusCode = urltils.isIgnoredError(
|
|
146
|
-
this.config,
|
|
147
|
-
transaction.statusCode
|
|
148
|
-
)
|
|
144
|
+
const isIgnoredErrorStatusCode = urltils.isIgnoredError(this.config, transaction.statusCode)
|
|
149
145
|
|
|
150
|
-
const isExpectedErrorStatusCode = urltils.isExpectedError(
|
|
151
|
-
this.config,
|
|
152
|
-
transaction.statusCode
|
|
153
|
-
)
|
|
146
|
+
const isExpectedErrorStatusCode = urltils.isExpectedError(this.config, transaction.statusCode)
|
|
154
147
|
|
|
155
148
|
// collect other exceptions only if status code is not ignored
|
|
156
149
|
if (transaction.exceptions.length && !isIgnoredErrorStatusCode) {
|
|
@@ -159,13 +152,9 @@ class ErrorCollector {
|
|
|
159
152
|
if (this.collect(transaction, exception)) {
|
|
160
153
|
++collectedErrors
|
|
161
154
|
// if we could collect it, then check if expected
|
|
162
|
-
if (
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
exception.error,
|
|
166
|
-
this.config,
|
|
167
|
-
urltils
|
|
168
|
-
)
|
|
155
|
+
if (
|
|
156
|
+
isExpectedErrorStatusCode ||
|
|
157
|
+
errorHelper.isExpectedException(transaction, exception.error, this.config, urltils)
|
|
169
158
|
) {
|
|
170
159
|
++expectedErrors
|
|
171
160
|
}
|
|
@@ -215,7 +204,7 @@ class ErrorCollector {
|
|
|
215
204
|
}
|
|
216
205
|
|
|
217
206
|
const timestamp = Date.now()
|
|
218
|
-
const exception = new Exception({error, timestamp, customAttributes})
|
|
207
|
+
const exception = new Exception({ error, timestamp, customAttributes })
|
|
219
208
|
|
|
220
209
|
if (transaction) {
|
|
221
210
|
transaction.addException(exception)
|
|
@@ -250,7 +239,7 @@ class ErrorCollector {
|
|
|
250
239
|
}
|
|
251
240
|
|
|
252
241
|
const timestamp = Date.now()
|
|
253
|
-
const exception = new Exception({error, timestamp, customAttributes})
|
|
242
|
+
const exception = new Exception({ error, timestamp, customAttributes })
|
|
254
243
|
|
|
255
244
|
if (transaction) {
|
|
256
245
|
transaction.addUserError(exception)
|
|
@@ -322,7 +311,7 @@ class ErrorCollector {
|
|
|
322
311
|
}
|
|
323
312
|
|
|
324
313
|
if (this.config.error_collector.capture_events === true) {
|
|
325
|
-
const priority = transaction && transaction.priority || Math.random()
|
|
314
|
+
const priority = (transaction && transaction.priority) || Math.random()
|
|
326
315
|
const event = createEvent(transaction, errorTrace, exception.timestamp, this.config)
|
|
327
316
|
this.eventAggregator.add(event, priority)
|
|
328
317
|
}
|
|
@@ -344,8 +333,7 @@ class ErrorCollector {
|
|
|
344
333
|
}
|
|
345
334
|
|
|
346
335
|
_shouldCollectErrors() {
|
|
347
|
-
const errorCollectorEnabled =
|
|
348
|
-
this.config.error_collector && this.config.error_collector.enabled
|
|
336
|
+
const errorCollectorEnabled = this.config.error_collector && this.config.error_collector.enabled
|
|
349
337
|
|
|
350
338
|
const shouldCaptureTraceOrEvent =
|
|
351
339
|
this.config.collect_errors || // are traces enabled
|
|
@@ -360,8 +348,7 @@ class ErrorCollector {
|
|
|
360
348
|
this.traceAggregator.reconfigure(config)
|
|
361
349
|
this.eventAggregator.reconfigure(config)
|
|
362
350
|
|
|
363
|
-
const errorCollectorEnabled =
|
|
364
|
-
this.config.error_collector && this.config.error_collector.enabled
|
|
351
|
+
const errorCollectorEnabled = this.config.error_collector && this.config.error_collector.enabled
|
|
365
352
|
|
|
366
353
|
if (!errorCollectorEnabled) {
|
|
367
354
|
this.stop()
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
'use strict'
|
|
7
7
|
|
|
8
|
-
const logger = require('../logger').child({component: 'error_tracer'})
|
|
8
|
+
const logger = require('../logger').child({ component: 'error_tracer' })
|
|
9
9
|
const EventAggregator = require('../aggregators/event-aggregator')
|
|
10
10
|
|
|
11
11
|
const NAMES = require('../metrics/names')
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
'use strict'
|
|
7
7
|
|
|
8
|
-
const logger = require('../logger').child({component: 'error_tracer'})
|
|
8
|
+
const logger = require('../logger').child({ component: 'error_tracer' })
|
|
9
9
|
const TraceAggregator = require('../aggregators/trace-aggregator')
|
|
10
10
|
|
|
11
11
|
// TODO: do traces ever have differing algorithms or
|
|
@@ -26,8 +26,7 @@ class ErrorTraceAggregator extends TraceAggregator {
|
|
|
26
26
|
logger.debug(error, 'Error to be sent to collector.')
|
|
27
27
|
this.errors.push(error)
|
|
28
28
|
} else {
|
|
29
|
-
logger.debug(
|
|
30
|
-
'Already have %d errors to send to collector, not keeping.', this.limit)
|
|
29
|
+
logger.debug('Already have %d errors to send to collector, not keeping.', this.limit)
|
|
31
30
|
}
|
|
32
31
|
}
|
|
33
32
|
|