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
|
@@ -5,17 +5,16 @@
|
|
|
5
5
|
|
|
6
6
|
'use strict'
|
|
7
7
|
|
|
8
|
-
var logger = require('../logger.js').child({component: 'gcp-info'})
|
|
8
|
+
var logger = require('../logger.js').child({ component: 'gcp-info' })
|
|
9
9
|
var common = require('./common')
|
|
10
10
|
var NAMES = require('../metrics/names.js')
|
|
11
|
+
let resultDict = null
|
|
11
12
|
|
|
12
13
|
module.exports = fetchGCPInfo
|
|
13
14
|
module.exports.clearCache = function clearGCPCache() {
|
|
14
15
|
resultDict = null
|
|
15
16
|
}
|
|
16
17
|
|
|
17
|
-
var resultDict
|
|
18
|
-
|
|
19
18
|
function fetchGCPInfo(agent, callback) {
|
|
20
19
|
if (!agent.config.utilization || !agent.config.utilization.detect_gcp) {
|
|
21
20
|
return setImmediate(callback, null)
|
|
@@ -25,37 +24,39 @@ function fetchGCPInfo(agent, callback) {
|
|
|
25
24
|
return setImmediate(callback, null, resultDict)
|
|
26
25
|
}
|
|
27
26
|
|
|
28
|
-
common.request(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
results.
|
|
56
|
-
|
|
57
|
-
|
|
27
|
+
common.request(
|
|
28
|
+
{
|
|
29
|
+
host: 'metadata.google.internal',
|
|
30
|
+
path: '/computeMetadata/v1/instance/?recursive=true',
|
|
31
|
+
headers: {
|
|
32
|
+
'Metadata-Flavor': 'Google'
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
agent,
|
|
36
|
+
function getMetadata(err, data) {
|
|
37
|
+
if (err) {
|
|
38
|
+
return callback(err)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
try {
|
|
42
|
+
data = JSON.parse(data)
|
|
43
|
+
} catch (e) {
|
|
44
|
+
logger.debug(e, 'Failed to parse GCP metadata.')
|
|
45
|
+
data = null
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
var results = common.getKeys(data, ['id', 'machineType', 'name', 'zone'])
|
|
49
|
+
if (results == null) {
|
|
50
|
+
logger.debug('GCP metadata was invalid.')
|
|
51
|
+
agent.metrics.getOrCreateMetric(NAMES.UTILIZATION.GCP_ERROR).incrementCallCount()
|
|
52
|
+
} else {
|
|
53
|
+
// normalize
|
|
54
|
+
results.machineType = results.machineType.substr(results.machineType.lastIndexOf('/') + 1)
|
|
55
|
+
results.zone = results.zone.substr(results.zone.lastIndexOf('/') + 1)
|
|
56
|
+
|
|
57
|
+
resultDict = results
|
|
58
|
+
}
|
|
59
|
+
callback(null, results)
|
|
58
60
|
}
|
|
59
|
-
|
|
60
|
-
})
|
|
61
|
+
)
|
|
61
62
|
}
|
package/lib/utilization/index.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
'use strict'
|
|
7
|
-
const logger = require('../logger').child({component: 'kubernetes-info'})
|
|
7
|
+
const logger = require('../logger').child({ component: 'kubernetes-info' })
|
|
8
8
|
|
|
9
9
|
let info = null
|
|
10
10
|
|
|
@@ -27,7 +27,7 @@ function getKubernetesInfo(agent, callback) {
|
|
|
27
27
|
return setImmediate(callback, null, null)
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
info = {kubernetes_service_host: process.env.KUBERNETES_SERVICE_HOST}
|
|
30
|
+
info = { kubernetes_service_host: process.env.KUBERNETES_SERVICE_HOST }
|
|
31
31
|
|
|
32
32
|
setImmediate(callback, null, info)
|
|
33
33
|
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
'use strict'
|
|
7
7
|
|
|
8
|
-
var logger = require('../logger.js').child({component: 'pcf-info'})
|
|
8
|
+
var logger = require('../logger.js').child({ component: 'pcf-info' })
|
|
9
9
|
var NAMES = require('../metrics/names.js')
|
|
10
10
|
var common = require('./common')
|
|
11
11
|
|
|
@@ -17,9 +17,9 @@ function fetchPCFInfo(agent, callback) {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
var metadataMap = {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
CF_INSTANCE_GUID: 'cf_instance_guid',
|
|
21
|
+
CF_INSTANCE_IP: 'cf_instance_ip',
|
|
22
|
+
MEMORY_LIMIT: 'memory_limit'
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
var results = Object.create(null)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "newrelic",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.3.0",
|
|
4
4
|
"author": "New Relic Node.js agent team <nodejs@newrelic.com>",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"contributors": [
|
|
@@ -98,6 +98,11 @@
|
|
|
98
98
|
"name": "Nick Tzaperas",
|
|
99
99
|
"email": "ntzaperas@newrelic.com",
|
|
100
100
|
"web": "https://newrelic.com"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"name": "Bob Evans",
|
|
104
|
+
"email": "revans@newrelic.com",
|
|
105
|
+
"web": "https://newrelic.com"
|
|
101
106
|
}
|
|
102
107
|
],
|
|
103
108
|
"description": "New Relic agent",
|
|
@@ -109,10 +114,10 @@
|
|
|
109
114
|
"debugging",
|
|
110
115
|
"profiling"
|
|
111
116
|
],
|
|
112
|
-
"homepage": "
|
|
117
|
+
"homepage": "https://github.com/newrelic/node-newrelic",
|
|
113
118
|
"engines": {
|
|
114
|
-
"node": ">=
|
|
115
|
-
"npm": ">=
|
|
119
|
+
"node": ">=12.0.0",
|
|
120
|
+
"npm": ">=6.0.0"
|
|
116
121
|
},
|
|
117
122
|
"directories": {
|
|
118
123
|
"lib": "lib"
|
|
@@ -122,9 +127,10 @@
|
|
|
122
127
|
"ca-gen": "./bin/update-ca-bundle.sh",
|
|
123
128
|
"docker-env": "./bin/docker-env-vars.sh",
|
|
124
129
|
"docs": "npm ci && jsdoc -c ./jsdoc-conf.json --private -r .",
|
|
125
|
-
"integration": "npm run prepare-test && npm run sub-install && time tap
|
|
130
|
+
"integration": "npm run prepare-test && npm run sub-install && time tap test/integration/**/**/*.tap.js --timeout=180 --no-coverage --reporter classic",
|
|
126
131
|
"prepare-test": "npm run ca-gen && npm run ssl && npm run docker-env",
|
|
127
132
|
"lint": "eslint ./*.js lib test bin",
|
|
133
|
+
"lint:fix": "eslint --fix, ./*.js lib test bin",
|
|
128
134
|
"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/",
|
|
129
135
|
"publish-docs": "./bin/publish-docs.sh",
|
|
130
136
|
"services": "./bin/docker-services.sh",
|
|
@@ -132,11 +138,14 @@
|
|
|
132
138
|
"ssl": "./bin/ssl.sh",
|
|
133
139
|
"sub-install": "node test/bin/install_sub_deps",
|
|
134
140
|
"test": "npm run integration && npm run unit",
|
|
135
|
-
"
|
|
141
|
+
"third-party-updates": "oss third-party manifest --includeOptDeps && oss third-party notices --includeOptDeps && git add THIRD_PARTY_NOTICES.md third_party_manifest.json",
|
|
142
|
+
"unit": "rm -f newrelic_agent.log && time tap --test-regex='(\\/|^test\\/unit\\/.*\\.test\\.js)$' --timeout=180 --no-coverage --reporter classic",
|
|
136
143
|
"update-cross-agent-tests": "./bin/update-cats.sh",
|
|
137
144
|
"versioned-tests": "./bin/run-versioned-tests.sh",
|
|
138
145
|
"update-changelog-version": "node ./bin/update-changelog-version",
|
|
139
|
-
"versioned": "npm run
|
|
146
|
+
"versioned": "npm run versioned:npm7",
|
|
147
|
+
"versioned:npm6": "npm run prepare-test && time ./bin/run-versioned-tests.sh",
|
|
148
|
+
"versioned:npm7": "npm run prepare-test && NPM7=1 time ./bin/run-versioned-tests.sh",
|
|
140
149
|
"prepare": "husky install"
|
|
141
150
|
},
|
|
142
151
|
"bin": {
|
|
@@ -145,33 +154,38 @@
|
|
|
145
154
|
"dependencies": {
|
|
146
155
|
"@grpc/grpc-js": "^1.2.11",
|
|
147
156
|
"@grpc/proto-loader": "^0.5.6",
|
|
148
|
-
"@newrelic/aws-sdk": "^
|
|
149
|
-
"@newrelic/koa": "^
|
|
150
|
-
"@newrelic/superagent": "^
|
|
157
|
+
"@newrelic/aws-sdk": "^4.0.1",
|
|
158
|
+
"@newrelic/koa": "^6.0.1",
|
|
159
|
+
"@newrelic/superagent": "^5.0.1",
|
|
151
160
|
"@tyriar/fibonacci-heap": "^2.0.7",
|
|
152
161
|
"async": "^3.2.0",
|
|
153
162
|
"concat-stream": "^2.0.0",
|
|
154
|
-
"https-proxy-agent": "^
|
|
163
|
+
"https-proxy-agent": "^5.0.0",
|
|
155
164
|
"json-stringify-safe": "^5.0.0",
|
|
156
165
|
"readable-stream": "^3.6.0",
|
|
157
166
|
"semver": "^5.3.0"
|
|
158
167
|
},
|
|
159
168
|
"optionalDependencies": {
|
|
160
|
-
"@newrelic/native-metrics": "^
|
|
169
|
+
"@newrelic/native-metrics": "^7.0.1"
|
|
161
170
|
},
|
|
162
171
|
"devDependencies": {
|
|
172
|
+
"@newrelic/eslint-config": "^0.0.2",
|
|
173
|
+
"@newrelic/newrelic-oss-cli": "^0.1.2",
|
|
163
174
|
"@newrelic/proxy": "^2.0.0",
|
|
164
|
-
"@newrelic/test-utilities": "^
|
|
175
|
+
"@newrelic/test-utilities": "^6.0.0",
|
|
165
176
|
"@octokit/rest": "^18.0.15",
|
|
166
|
-
"
|
|
177
|
+
"ajv": "^6.12.6",
|
|
167
178
|
"architect": "*",
|
|
168
179
|
"benchmark": "^2.1.4",
|
|
169
180
|
"bluebird": "^3.4.7",
|
|
170
181
|
"chai": "^4.1.2",
|
|
171
182
|
"commander": "^7.0.0",
|
|
172
|
-
"eslint": "^
|
|
183
|
+
"eslint": "^7.32.0",
|
|
184
|
+
"eslint-config-prettier": "^8.3.0",
|
|
185
|
+
"eslint-plugin-header": "^3.1.1",
|
|
186
|
+
"eslint-plugin-node": "^11.1.0",
|
|
187
|
+
"eslint-plugin-prettier": "^3.4.0",
|
|
173
188
|
"express": "*",
|
|
174
|
-
"fastify": "^2.15.3",
|
|
175
189
|
"generic-pool": "^3.6.1",
|
|
176
190
|
"glob": "^7.1.2",
|
|
177
191
|
"got": "^8.0.1",
|
|
@@ -184,6 +198,7 @@
|
|
|
184
198
|
"mongodb": "^3.3.3",
|
|
185
199
|
"mysql": "*",
|
|
186
200
|
"nock": "11.8.0",
|
|
201
|
+
"prettier": "^2.3.2",
|
|
187
202
|
"proxyquire": "^1.8.0",
|
|
188
203
|
"q": "*",
|
|
189
204
|
"redis": "^1.0.0",
|
|
@@ -192,9 +207,8 @@
|
|
|
192
207
|
"rimraf": "^2.6.3",
|
|
193
208
|
"should": "*",
|
|
194
209
|
"sinon": "^4.5.0",
|
|
195
|
-
"tap": "^
|
|
210
|
+
"tap": "^15.0.9",
|
|
196
211
|
"temp": "^0.8.1",
|
|
197
|
-
"through": "^2.3.6",
|
|
198
212
|
"when": "*"
|
|
199
213
|
},
|
|
200
214
|
"repository": {
|
package/stub_api.js
CHANGED
|
@@ -9,13 +9,16 @@ var logger = require('./lib/logger.js')
|
|
|
9
9
|
var RealAPI = require('./api.js')
|
|
10
10
|
var TransactionHandle = require('./lib/transaction/handle')
|
|
11
11
|
|
|
12
|
-
|
|
13
12
|
/* eslint-disable no-eval */
|
|
14
13
|
function stubFunction(name) {
|
|
15
14
|
return eval(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
'(function () {return function ' +
|
|
16
|
+
name +
|
|
17
|
+
'() {' +
|
|
18
|
+
"logger.debug('Not calling " +
|
|
19
|
+
name +
|
|
20
|
+
" because New Relic is disabled.');" +
|
|
21
|
+
'}}())'
|
|
19
22
|
)
|
|
20
23
|
}
|
|
21
24
|
/* eslint-enable no-eval */
|
|
@@ -25,7 +28,6 @@ function Stub() {}
|
|
|
25
28
|
var keys = Object.keys(RealAPI.prototype)
|
|
26
29
|
var length = keys.length
|
|
27
30
|
|
|
28
|
-
|
|
29
31
|
/* This way the stub API doesn't have to be updated in lockstep with the regular
|
|
30
32
|
* API.
|
|
31
33
|
*/
|
|
@@ -110,7 +112,7 @@ function shutdown(options, cb) {
|
|
|
110
112
|
if (typeof options === 'function') {
|
|
111
113
|
callback = options
|
|
112
114
|
} else {
|
|
113
|
-
callback = function
|
|
115
|
+
callback = function __NRDefaultCb() {}
|
|
114
116
|
}
|
|
115
117
|
}
|
|
116
118
|
|