newrelic 6.3.0 → 6.5.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/{.eslintrc → .eslintrc.js} +4 -2
- package/.travis.yml +0 -1
- package/NEWS.md +136 -0
- package/README.md +1 -0
- package/api.js +75 -4
- package/bin/publish-docs.sh +1 -1
- package/bin/travis-node.sh +4 -1
- package/index.js +3 -3
- package/lib/aggregators/base-aggregator.js +1 -1
- package/lib/attributes.js +15 -6
- package/lib/config/default.js +11 -1
- package/lib/config/env.js +3 -1
- package/lib/config/hsm.js +6 -1
- package/lib/config/index.js +29 -8
- package/lib/config/lasp.js +16 -1
- package/lib/errors/error-collector.js +51 -90
- package/lib/errors/helper.js +13 -13
- package/lib/errors/index.js +36 -18
- package/lib/feature_flags.js +3 -3
- package/lib/header-processing.js +75 -0
- package/lib/instrumentation/core/child_process.js +12 -0
- package/lib/instrumentation/core/http-outbound.js +6 -28
- package/lib/instrumentation/core/http.js +100 -170
- package/lib/instrumentation/hapi/hapi-17.js +10 -3
- package/lib/metrics/names.js +1 -0
- package/lib/serverless/aws-lambda.js +79 -33
- package/lib/serverless/event-sources.json +128 -0
- package/lib/shim/transaction-shim.js +10 -33
- package/lib/spans/span-event-aggregator.js +2 -2
- package/lib/spans/span-event.js +33 -11
- package/lib/transaction/handle.js +73 -4
- package/lib/transaction/index.js +182 -34
- package/lib/transaction/trace/index.js +6 -5
- package/lib/transaction/trace/segment.js +12 -1
- package/lib/transaction/tracecontext.js +409 -163
- package/lib/util/get.js +16 -0
- package/lib/util/hashes.js +55 -6
- package/package.json +8 -10
- package/stub_api.js +5 -0
package/lib/util/get.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
// A simplified implementation of lodash.get
|
|
4
|
+
// see: https://www.npmjs.com/package/lodash.get
|
|
5
|
+
function get(obj, keys, defaultVal) {
|
|
6
|
+
keys = Array.isArray(keys) ? keys : keys.replace(/(\[(\d)\])/g, '.$2').split('.')
|
|
7
|
+
obj = obj[keys[0]]
|
|
8
|
+
|
|
9
|
+
if (obj && keys.length > 1) {
|
|
10
|
+
return get(obj, keys.slice(1), defaultVal)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return obj === undefined ? defaultVal : obj
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
module.exports = get
|
package/lib/util/hashes.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
const crypto = require('crypto')
|
|
4
4
|
|
|
5
5
|
function encode(bytes, keyBytes) {
|
|
6
6
|
for (var i = 0; i < bytes.length; i++) {
|
|
@@ -52,11 +52,60 @@ function getHash(appName, txName) {
|
|
|
52
52
|
return buf.slice(buf.length - 4, buf.length).readUInt32BE(0)
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
return Math.floor((
|
|
55
|
+
const rand = Math.random
|
|
56
|
+
|
|
57
|
+
const max32 = Math.pow(2, 32) - 1
|
|
58
|
+
function randInt32() {
|
|
59
|
+
return Math.floor(rand() * max32)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function int32ToByteArray(int32) {
|
|
63
|
+
// we want to represent the input as a 4-bytes array
|
|
64
|
+
let byteArray = new Uint8Array(4)
|
|
65
|
+
|
|
66
|
+
for (let i = 0; i < byteArray.length; i++) {
|
|
67
|
+
let byte = int32 & 0xff
|
|
68
|
+
byteArray[i] = byte
|
|
69
|
+
int32 = (int32 - byte) / 256
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return byteArray
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Lookup table for converting byte values to hex
|
|
76
|
+
const byteToHex = []
|
|
77
|
+
for (let i = 0; i < 256; ++i) {
|
|
78
|
+
byteToHex[i] = (i + 0x100).toString(16).substr(1)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function makeId(length = 16) {
|
|
82
|
+
// length is number of hex characters, which multiplied by 4 is the number of
|
|
83
|
+
// bits, then divided by 8 is number of bytes. Or just divide by 2
|
|
84
|
+
const numBytes = Math.ceil(length / 2)
|
|
85
|
+
let randBytes = new Uint8Array(numBytes)
|
|
86
|
+
|
|
87
|
+
// Generate random bytes one 32-bit integer at a time
|
|
88
|
+
const numInts = Math.ceil(numBytes / 4) // 32 bit integers are 4 bytes
|
|
89
|
+
for (let i = 0; i < numInts; i++) {
|
|
90
|
+
const int = randInt32()
|
|
91
|
+
const bytes = int32ToByteArray(int)
|
|
92
|
+
for (let j = 0; j < 4; j++) {
|
|
93
|
+
// This could "overflow" since we're iterating over the number of ints, which could
|
|
94
|
+
// be more data than needed. But out-of-bound index assignment on typed arrays are
|
|
95
|
+
// discarded
|
|
96
|
+
randBytes[(i * 4) + j] = bytes[j]
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Convert the byte array to a hex string
|
|
101
|
+
let id = ''
|
|
102
|
+
for (let i = 0; i < randBytes.length; i++) {
|
|
103
|
+
id += byteToHex[randBytes[i]]
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// For odd number lengths, we may get an extra character since byteToHex returns two
|
|
107
|
+
// characters, so trim to the desired length.
|
|
108
|
+
return id.substring(0, length)
|
|
60
109
|
}
|
|
61
110
|
|
|
62
111
|
exports.obfuscateNameUsingKey = obfuscateNameUsingKey
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "newrelic",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.5.0",
|
|
4
4
|
"author": "New Relic Node.js agent team <nodejs@newrelic.com>",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"contributors": [
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
],
|
|
97
97
|
"homepage": "http://github.com/newrelic/node-newrelic",
|
|
98
98
|
"engines": {
|
|
99
|
-
"node": ">=8.0.0
|
|
99
|
+
"node": ">=8.0.0",
|
|
100
100
|
"npm": ">=3.0.0"
|
|
101
101
|
},
|
|
102
102
|
"directories": {
|
|
@@ -113,13 +113,12 @@
|
|
|
113
113
|
"lint": "eslint ./*.js lib test",
|
|
114
114
|
"public-docs": "npm ci && jsdoc -c ./jsdoc-conf.json --tutorials examples/shim api.js lib/shim/ lib/transaction/handle.js && cp examples/shim/*.png out/",
|
|
115
115
|
"publish-docs": "./bin/publish-docs.sh",
|
|
116
|
-
"security": "npm audit",
|
|
117
116
|
"services": "./bin/docker-services.sh",
|
|
118
117
|
"smoke": "npm run clean && ./bin/smoke.sh",
|
|
119
118
|
"ssl": "./bin/ssl.sh",
|
|
120
119
|
"sub-install": "node test/bin/install_sub_deps",
|
|
121
120
|
"test": "npm run integration && npm run unit",
|
|
122
|
-
"unit": "rm -f newrelic_agent.log &&
|
|
121
|
+
"unit": "rm -f newrelic_agent.log && time tap --test-regex='(\\/|^test\\/unit\\/.*\\.test\\.js)$' --timeout=120 --no-coverage",
|
|
123
122
|
"update-cross-agent-tests": "./bin/update-cats.sh",
|
|
124
123
|
"versioned-tests": "./bin/run-versioned-tests.sh",
|
|
125
124
|
"versioned": "npm run prepare-test && time ./bin/run-versioned-tests.sh"
|
|
@@ -128,15 +127,15 @@
|
|
|
128
127
|
"newrelic-naming-rules": "./bin/test-naming-rules.js"
|
|
129
128
|
},
|
|
130
129
|
"dependencies": {
|
|
131
|
-
"@newrelic/aws-sdk": "^1.1.
|
|
130
|
+
"@newrelic/aws-sdk": "^1.1.2",
|
|
132
131
|
"@newrelic/koa": "^3.0.0",
|
|
133
|
-
"@newrelic/superagent": "^2.0.
|
|
132
|
+
"@newrelic/superagent": "^2.0.1",
|
|
134
133
|
"@tyriar/fibonacci-heap": "^2.0.7",
|
|
135
134
|
"async": "^2.1.4",
|
|
136
135
|
"concat-stream": "^2.0.0",
|
|
137
136
|
"escodegen": "^1.11.1",
|
|
138
137
|
"esprima": "^4.0.1",
|
|
139
|
-
"https-proxy-agent": "^
|
|
138
|
+
"https-proxy-agent": "^4.0.0",
|
|
140
139
|
"json-stringify-safe": "^5.0.0",
|
|
141
140
|
"readable-stream": "^3.1.1",
|
|
142
141
|
"semver": "^5.3.0"
|
|
@@ -152,7 +151,7 @@
|
|
|
152
151
|
"benchmark": "^2.1.4",
|
|
153
152
|
"bluebird": "^3.4.7",
|
|
154
153
|
"chai": "^4.1.2",
|
|
155
|
-
"eslint": "^
|
|
154
|
+
"eslint": "^6.8.0",
|
|
156
155
|
"express": "*",
|
|
157
156
|
"generic-pool": "^3.6.1",
|
|
158
157
|
"glob": "^7.1.2",
|
|
@@ -161,10 +160,9 @@
|
|
|
161
160
|
"lodash": "^4.17.14",
|
|
162
161
|
"memcached": ">=0.2.8",
|
|
163
162
|
"minami": "^1.1.1",
|
|
164
|
-
"mocha": "^6.2.1",
|
|
165
163
|
"mongodb": "^3.3.3",
|
|
166
164
|
"mysql": "*",
|
|
167
|
-
"nock": "
|
|
165
|
+
"nock": "11.8.0",
|
|
168
166
|
"proxyquire": "^1.8.0",
|
|
169
167
|
"q": "*",
|
|
170
168
|
"redis": "^1.0.0",
|
package/stub_api.js
CHANGED
|
@@ -36,6 +36,7 @@ Stub.prototype.getTransaction = getTransaction
|
|
|
36
36
|
Stub.prototype.getBrowserTimingHeader = getBrowserTimingHeader
|
|
37
37
|
Stub.prototype.shutdown = shutdown
|
|
38
38
|
Stub.prototype.setLambdaHandler = setLambdaHandler
|
|
39
|
+
Stub.prototype.getLinkingMetadata = getLinkingMetadata
|
|
39
40
|
Stub.prototype.getTraceMetadata = getTraceMetadata
|
|
40
41
|
|
|
41
42
|
// This code gets injected into HTML templates
|
|
@@ -62,6 +63,10 @@ function startSegment(name, record, handler, callback) {
|
|
|
62
63
|
return null
|
|
63
64
|
}
|
|
64
65
|
|
|
66
|
+
function getLinkingMetadata() {
|
|
67
|
+
return {}
|
|
68
|
+
}
|
|
69
|
+
|
|
65
70
|
function getTraceMetadata() {
|
|
66
71
|
return {
|
|
67
72
|
traceId: '',
|