newrelic 8.17.1 → 9.0.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 +5416 -5374
- package/THIRD_PARTY_NOTICES.md +40 -9
- package/index.js +2 -2
- package/lib/collector/http-agents.js +4 -21
- package/lib/collector/remote-method.js +0 -16
- package/lib/config/index.js +0 -7
- package/lib/feature_flags.js +3 -3
- package/lib/instrumentation/core/async_hooks.js +1 -38
- package/lib/instrumentation/core/http-outbound.js +8 -12
- package/lib/instrumentation/hapi/{hapi-17.js → hapi.js} +0 -0
- package/lib/instrumentation/hapi.js +1 -23
- package/lib/instrumentation/pg.js +3 -18
- package/lib/instrumentations.js +0 -2
- package/lib/metrics/names.js +0 -8
- package/package.json +13 -9
- package/lib/collector/ssl/certificates.js +0 -1165
- package/lib/db/parse-sql.js +0 -62
- package/lib/instrumentation/oracle.js +0 -130
package/THIRD_PARTY_NOTICES.md
CHANGED
|
@@ -26,6 +26,7 @@ code, the source code can be found at [https://github.com/newrelic/node-newrelic
|
|
|
26
26
|
* [json-stringify-safe](#json-stringify-safe)
|
|
27
27
|
* [readable-stream](#readable-stream)
|
|
28
28
|
* [semver](#semver)
|
|
29
|
+
* [winston-transport](#winston-transport)
|
|
29
30
|
|
|
30
31
|
**[devDependencies](#devDependencies)**
|
|
31
32
|
|
|
@@ -294,7 +295,7 @@ This product includes source derived from [@grpc/grpc-js](https://github.com/grp
|
|
|
294
295
|
|
|
295
296
|
### @grpc/proto-loader
|
|
296
297
|
|
|
297
|
-
This product includes source derived from [@grpc/proto-loader](https://github.com/grpc/grpc-node) ([v0.6.
|
|
298
|
+
This product includes source derived from [@grpc/proto-loader](https://github.com/grpc/grpc-node) ([v0.6.13](https://github.com/grpc/grpc-node/tree/v0.6.13)), distributed under the [Apache-2.0 License](https://github.com/grpc/grpc-node/blob/v0.6.13/LICENSE):
|
|
298
299
|
|
|
299
300
|
```
|
|
300
301
|
Apache License
|
|
@@ -503,7 +504,7 @@ This product includes source derived from [@grpc/proto-loader](https://github.co
|
|
|
503
504
|
|
|
504
505
|
### @newrelic/aws-sdk
|
|
505
506
|
|
|
506
|
-
This product includes source derived from [@newrelic/aws-sdk](https://github.com/newrelic/node-newrelic-aws-sdk) ([
|
|
507
|
+
This product includes source derived from [@newrelic/aws-sdk](https://github.com/newrelic/node-newrelic-aws-sdk) ([v5.0.0](https://github.com/newrelic/node-newrelic-aws-sdk/tree/v5.0.0)), distributed under the [Apache-2.0 License](https://github.com/newrelic/node-newrelic-aws-sdk/blob/v5.0.0/LICENSE):
|
|
507
508
|
|
|
508
509
|
```
|
|
509
510
|
Apache License
|
|
@@ -711,7 +712,7 @@ This product includes source derived from [@newrelic/aws-sdk](https://github.com
|
|
|
711
712
|
|
|
712
713
|
### @newrelic/koa
|
|
713
714
|
|
|
714
|
-
This product includes source derived from [@newrelic/koa](https://github.com/newrelic/node-newrelic-koa) ([
|
|
715
|
+
This product includes source derived from [@newrelic/koa](https://github.com/newrelic/node-newrelic-koa) ([v7.0.0](https://github.com/newrelic/node-newrelic-koa/tree/v7.0.0)), distributed under the [Apache-2.0 License](https://github.com/newrelic/node-newrelic-koa/blob/v7.0.0/LICENSE):
|
|
715
716
|
|
|
716
717
|
```
|
|
717
718
|
Apache License
|
|
@@ -920,7 +921,7 @@ Apache License
|
|
|
920
921
|
|
|
921
922
|
### @newrelic/superagent
|
|
922
923
|
|
|
923
|
-
This product includes source derived from [@newrelic/superagent](https://github.com/newrelic/node-newrelic-superagent) ([
|
|
924
|
+
This product includes source derived from [@newrelic/superagent](https://github.com/newrelic/node-newrelic-superagent) ([v6.0.0](https://github.com/newrelic/node-newrelic-superagent/tree/v6.0.0)), distributed under the [Apache-2.0 License](https://github.com/newrelic/node-newrelic-superagent/blob/v6.0.0/LICENSE):
|
|
924
925
|
|
|
925
926
|
```
|
|
926
927
|
Apache License
|
|
@@ -1329,6 +1330,36 @@ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
1329
1330
|
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
|
1330
1331
|
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
1331
1332
|
|
|
1333
|
+
```
|
|
1334
|
+
|
|
1335
|
+
### winston-transport
|
|
1336
|
+
|
|
1337
|
+
This product includes source derived from [winston-transport](https://github.com/winstonjs/winston-transport) ([v4.5.0](https://github.com/winstonjs/winston-transport/tree/v4.5.0)), distributed under the [MIT License](https://github.com/winstonjs/winston-transport/blob/v4.5.0/LICENSE):
|
|
1338
|
+
|
|
1339
|
+
```
|
|
1340
|
+
The MIT License (MIT)
|
|
1341
|
+
|
|
1342
|
+
Copyright (c) 2015 Charlie Robbins & the contributors.
|
|
1343
|
+
|
|
1344
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
1345
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
1346
|
+
in the Software without restriction, including without limitation the rights
|
|
1347
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
1348
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
1349
|
+
furnished to do so, subject to the following conditions:
|
|
1350
|
+
|
|
1351
|
+
The above copyright notice and this permission notice shall be included in all
|
|
1352
|
+
copies or substantial portions of the Software.
|
|
1353
|
+
|
|
1354
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
1355
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
1356
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
1357
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
1358
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
1359
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1360
|
+
SOFTWARE.
|
|
1361
|
+
|
|
1362
|
+
|
|
1332
1363
|
```
|
|
1333
1364
|
|
|
1334
1365
|
|
|
@@ -1769,7 +1800,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
|
|
1769
1800
|
|
|
1770
1801
|
### @newrelic/test-utilities
|
|
1771
1802
|
|
|
1772
|
-
This product includes source derived from [@newrelic/test-utilities](https://github.com/newrelic/node-test-utilities) ([
|
|
1803
|
+
This product includes source derived from [@newrelic/test-utilities](https://github.com/newrelic/node-test-utilities) ([v7.0.0](https://github.com/newrelic/node-test-utilities/tree/v7.0.0)), distributed under the [Apache-2.0 License](https://github.com/newrelic/node-test-utilities/blob/v7.0.0/LICENSE):
|
|
1773
1804
|
|
|
1774
1805
|
```
|
|
1775
1806
|
Apache License
|
|
@@ -2484,7 +2515,7 @@ https://creativecommons.org/licenses/by-sa/4.0/
|
|
|
2484
2515
|
|
|
2485
2516
|
### got
|
|
2486
2517
|
|
|
2487
|
-
This product includes source derived from [got](https://github.com/sindresorhus/got) ([
|
|
2518
|
+
This product includes source derived from [got](https://github.com/sindresorhus/got) ([v11.8.5](https://github.com/sindresorhus/got/tree/v11.8.5)), distributed under the [MIT License](https://github.com/sindresorhus/got/blob/v11.8.5/license):
|
|
2488
2519
|
|
|
2489
2520
|
```
|
|
2490
2521
|
MIT License
|
|
@@ -3264,12 +3295,12 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
3264
3295
|
|
|
3265
3296
|
### tap
|
|
3266
3297
|
|
|
3267
|
-
This product includes source derived from [tap](https://github.com/tapjs/node-tap) ([
|
|
3298
|
+
This product includes source derived from [tap](https://github.com/tapjs/node-tap) ([v16.0.1](https://github.com/tapjs/node-tap/tree/v16.0.1)), distributed under the [ISC License](https://github.com/tapjs/node-tap/blob/v16.0.1/LICENSE):
|
|
3268
3299
|
|
|
3269
3300
|
```
|
|
3270
3301
|
The ISC License
|
|
3271
3302
|
|
|
3272
|
-
Copyright (c) Isaac Z. Schlueter and Contributors
|
|
3303
|
+
Copyright (c) 2011-2022 Isaac Z. Schlueter and Contributors
|
|
3273
3304
|
|
|
3274
3305
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
3275
3306
|
purpose with or without fee is hereby granted, provided that the above
|
|
@@ -3349,7 +3380,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
3349
3380
|
|
|
3350
3381
|
### @newrelic/native-metrics
|
|
3351
3382
|
|
|
3352
|
-
This product includes source derived from [@newrelic/native-metrics](https://github.com/newrelic/node-native-metrics) ([
|
|
3383
|
+
This product includes source derived from [@newrelic/native-metrics](https://github.com/newrelic/node-native-metrics) ([v9.0.0](https://github.com/newrelic/node-native-metrics/tree/v9.0.0)), distributed under the [Apache-2.0 License](https://github.com/newrelic/node-native-metrics/blob/v9.0.0/LICENSE):
|
|
3353
3384
|
|
|
3354
3385
|
```
|
|
3355
3386
|
Apache License
|
package/index.js
CHANGED
|
@@ -53,8 +53,8 @@ function initialize() {
|
|
|
53
53
|
throw new Error(message)
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
// TODO: Update this check when Node
|
|
57
|
-
if (psemver.satisfies('>=
|
|
56
|
+
// TODO: Update this check when Node v20 support is added
|
|
57
|
+
if (psemver.satisfies('>=19.0.0')) {
|
|
58
58
|
logger.warn(
|
|
59
59
|
'New Relic for Node.js %s has not been tested on Node.js %s. Please ' +
|
|
60
60
|
'update the agent or downgrade your version of Node.js',
|
|
@@ -8,8 +8,6 @@
|
|
|
8
8
|
const parse = require('url').parse
|
|
9
9
|
const ProxyAgent = require('https-proxy-agent')
|
|
10
10
|
const logger = require('../logger').child({ component: 'http-agent' })
|
|
11
|
-
const certificates = require('./ssl/certificates.js')
|
|
12
|
-
|
|
13
11
|
const https = require('https')
|
|
14
12
|
|
|
15
13
|
// poor person's single-instance-objects. We
|
|
@@ -21,6 +19,8 @@ let agentProxyWithKeepAlive = null
|
|
|
21
19
|
|
|
22
20
|
/**
|
|
23
21
|
* Returns an HTTP agent with keep-alive enabled
|
|
22
|
+
*
|
|
23
|
+
* @param config
|
|
24
24
|
*/
|
|
25
25
|
exports.keepAliveAgent = function keepAliveAgent(config) {
|
|
26
26
|
config = config ? config : {}
|
|
@@ -45,6 +45,8 @@ exports.keepAliveAgent = function keepAliveAgent(config) {
|
|
|
45
45
|
* Include keep-alive configuration, but ultimately its up
|
|
46
46
|
* to the proxy server as to how its connection is made
|
|
47
47
|
* with New Relic's servers.
|
|
48
|
+
*
|
|
49
|
+
* @param config
|
|
48
50
|
*/
|
|
49
51
|
exports.proxyAgent = function proxyAgent(config) {
|
|
50
52
|
if (null !== agentProxyWithKeepAlive) {
|
|
@@ -109,25 +111,6 @@ function proxyOptions(config) {
|
|
|
109
111
|
|
|
110
112
|
if (config.certificates && config.certificates.length > 0) {
|
|
111
113
|
opts.certificates = config.certificates
|
|
112
|
-
|
|
113
|
-
// merge user certificates with built-in certs
|
|
114
|
-
if (config.feature_flag.certificate_bundle) {
|
|
115
|
-
logger.info(
|
|
116
|
-
'Using a proxy with a special cert. This enables our cert bundle which, combined ' +
|
|
117
|
-
'with some versions of node, exacerbates a leak in node core TLS.'
|
|
118
|
-
)
|
|
119
|
-
|
|
120
|
-
const certWarningMessage = [
|
|
121
|
-
'Deprecation Warning: The certificate bundle included by New Relic will be ',
|
|
122
|
-
'disabled by default and then fully removed in later major versions. We recommend ',
|
|
123
|
-
'testing with the certificate_bundle feature flag set to `false` to determine if ',
|
|
124
|
-
'you will need to modify your environment or setup your own appropriate bundle. ',
|
|
125
|
-
'Example configuration: feature_flag: { certificate_bundle: false }.'
|
|
126
|
-
].join('')
|
|
127
|
-
logger.warnOnce('CERT_WARNING', certWarningMessage)
|
|
128
|
-
|
|
129
|
-
opts.certificates = config.certificates.concat(certificates)
|
|
130
|
-
}
|
|
131
114
|
}
|
|
132
115
|
|
|
133
116
|
return opts
|
|
@@ -14,7 +14,6 @@ const parse = require('./parse-response')
|
|
|
14
14
|
const stringify = require('json-stringify-safe')
|
|
15
15
|
const Sink = require('../util/stream-sink')
|
|
16
16
|
const agents = require('./http-agents')
|
|
17
|
-
const certificates = require('./ssl/certificates')
|
|
18
17
|
const isValidLength = require('../util/byte-limit').isValidLength
|
|
19
18
|
const { DATA_USAGE } = require('../metrics/names')
|
|
20
19
|
|
|
@@ -306,21 +305,6 @@ RemoteMethod.prototype._request = function _request(options) {
|
|
|
306
305
|
} else {
|
|
307
306
|
if (this._config.certificates && this._config.certificates.length > 0) {
|
|
308
307
|
requestOptions.ca = this._config.certificates
|
|
309
|
-
|
|
310
|
-
if (this._config.feature_flag.certificate_bundle) {
|
|
311
|
-
logger.debug('Adding custom certificate to the cert bundle.')
|
|
312
|
-
|
|
313
|
-
const certWarningMessage = [
|
|
314
|
-
'Deprecation Warning: The certificate bundle included by New Relic will be ',
|
|
315
|
-
'disabled by default and then fully removed in later major versions. We recommend ',
|
|
316
|
-
'testing with the certificate_bundle feature flag set to `false` to determine if ',
|
|
317
|
-
'you will need to modify your environment or setup your own appropriate bundle. ',
|
|
318
|
-
'Example configuration: feature_flag: { certificate_bundle: false }.'
|
|
319
|
-
].join('')
|
|
320
|
-
logger.warnOnce('CERT_WARNING', certWarningMessage)
|
|
321
|
-
|
|
322
|
-
requestOptions.ca = this._config.certificates.concat(certificates)
|
|
323
|
-
}
|
|
324
308
|
}
|
|
325
309
|
request = https.request(requestOptions)
|
|
326
310
|
}
|
package/lib/config/index.js
CHANGED
|
@@ -858,13 +858,6 @@ Config.prototype.logUnknown = function logUnknown(json, key) {
|
|
|
858
858
|
logger.debug('New Relic sent unknown configuration parameter %s with value %s.', key, value)
|
|
859
859
|
}
|
|
860
860
|
|
|
861
|
-
/**
|
|
862
|
-
* Return the availability of async_hook for use by the agent.
|
|
863
|
-
*/
|
|
864
|
-
Config.prototype.checkAsyncHookStatus = function checkAsyncHookStatus() {
|
|
865
|
-
return this.feature_flag.await_support
|
|
866
|
-
}
|
|
867
|
-
|
|
868
861
|
/**
|
|
869
862
|
* Gets the user set host display name. If not provided, it returns the default value.
|
|
870
863
|
*
|
package/lib/feature_flags.js
CHANGED
|
@@ -7,8 +7,6 @@
|
|
|
7
7
|
|
|
8
8
|
// unreleased flags gating an active feature
|
|
9
9
|
exports.prerelease = {
|
|
10
|
-
await_support: true,
|
|
11
|
-
certificate_bundle: false,
|
|
12
10
|
express5: false,
|
|
13
11
|
new_promise_tracking: false,
|
|
14
12
|
promise_segments: false,
|
|
@@ -31,7 +29,9 @@ exports.released = [
|
|
|
31
29
|
'send_request_uri_attribute',
|
|
32
30
|
'synthetics',
|
|
33
31
|
'dt_format_w3c',
|
|
34
|
-
'fastify_instrumentation'
|
|
32
|
+
'fastify_instrumentation',
|
|
33
|
+
'await_support',
|
|
34
|
+
'certificate_bundle'
|
|
35
35
|
]
|
|
36
36
|
|
|
37
37
|
// flags that are no longer used for unreleased features
|
|
@@ -6,48 +6,11 @@
|
|
|
6
6
|
'use strict'
|
|
7
7
|
|
|
8
8
|
const logger = require('../../logger').child({ component: 'async_hooks' })
|
|
9
|
-
const
|
|
9
|
+
const asyncHooks = require('async_hooks')
|
|
10
10
|
|
|
11
11
|
module.exports = initialize
|
|
12
12
|
|
|
13
|
-
/**
|
|
14
|
-
* The spec for the native `Promise` class.
|
|
15
|
-
*/
|
|
16
|
-
const STATIC_PROMISE_METHODS = ['accept', 'all', 'defer', 'race', 'reject', 'resolve']
|
|
17
|
-
const NATIVE_PROMISE_SPEC = {
|
|
18
|
-
name: 'global',
|
|
19
|
-
constructor: 'Promise',
|
|
20
|
-
executor: true,
|
|
21
|
-
useFinally: false,
|
|
22
|
-
$proto: {
|
|
23
|
-
then: ['then', 'chain'],
|
|
24
|
-
catch: ['catch']
|
|
25
|
-
},
|
|
26
|
-
$static: {
|
|
27
|
-
$copy: STATIC_PROMISE_METHODS,
|
|
28
|
-
cast: STATIC_PROMISE_METHODS
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
13
|
function initialize(agent, shim) {
|
|
33
|
-
const enableHooks = agent.config.checkAsyncHookStatus()
|
|
34
|
-
if (enableHooks && tryAsyncHooks(agent, shim)) {
|
|
35
|
-
logger.debug('Using async_hooks.')
|
|
36
|
-
} else {
|
|
37
|
-
logger.debug('Using promise instrumentation.')
|
|
38
|
-
promInit(agent, global, NATIVE_PROMISE_SPEC)
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function tryAsyncHooks(agent, shim) {
|
|
43
|
-
let asyncHooks = null
|
|
44
|
-
try {
|
|
45
|
-
asyncHooks = require('async_hooks')
|
|
46
|
-
} catch (e) {
|
|
47
|
-
logger.info(e, 'Not using async_hooks module.')
|
|
48
|
-
return false
|
|
49
|
-
}
|
|
50
|
-
|
|
51
14
|
// this map is reused to track the segment that was active when
|
|
52
15
|
// the before callback is called to be replaced in the after callback
|
|
53
16
|
const segmentMap = new Map()
|
|
@@ -17,7 +17,7 @@ const NAMES = require('../../metrics/names')
|
|
|
17
17
|
const SHIM_SYMBOLS = require('../../shim/constants').SYMBOLS
|
|
18
18
|
|
|
19
19
|
const DEFAULT_HOST = 'localhost'
|
|
20
|
-
const
|
|
20
|
+
const DEFAULT_HTTP_PORT = 80
|
|
21
21
|
const DEFAULT_SSL_PORT = 443
|
|
22
22
|
|
|
23
23
|
const NEWRELIC_SYNTHETICS_HEADER = 'x-newrelic-synthetics'
|
|
@@ -27,9 +27,8 @@ const NEWRELIC_SYNTHETICS_HEADER = 'x-newrelic-synthetics'
|
|
|
27
27
|
*
|
|
28
28
|
* @param {Agent} agent
|
|
29
29
|
* @param {object} opts
|
|
30
|
-
* @param {
|
|
31
|
-
*
|
|
32
|
-
* @return {http.ClientRequest} The instrumented outbound request.
|
|
30
|
+
* @param {Function} makeRequest
|
|
31
|
+
* @returns {http.ClientRequest} The instrumented outbound request.
|
|
33
32
|
*/
|
|
34
33
|
module.exports = function instrumentOutbound(agent, opts, makeRequest) {
|
|
35
34
|
if (typeof opts === 'string') {
|
|
@@ -38,10 +37,12 @@ module.exports = function instrumentOutbound(agent, opts, makeRequest) {
|
|
|
38
37
|
opts = copy.shallow(opts)
|
|
39
38
|
}
|
|
40
39
|
|
|
40
|
+
const defaultPort =
|
|
41
|
+
!opts.protocol || opts.protocol === 'http:' ? DEFAULT_HTTP_PORT : DEFAULT_SSL_PORT
|
|
41
42
|
let hostname = opts.hostname || opts.host || DEFAULT_HOST
|
|
42
43
|
let port = opts.port || opts.defaultPort
|
|
43
44
|
if (!port) {
|
|
44
|
-
port =
|
|
45
|
+
port = defaultPort
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
if (!hostname || port < 1) {
|
|
@@ -49,11 +50,7 @@ module.exports = function instrumentOutbound(agent, opts, makeRequest) {
|
|
|
49
50
|
return makeRequest(opts)
|
|
50
51
|
}
|
|
51
52
|
|
|
52
|
-
|
|
53
|
-
// but due to legacy issues we can't do that without moving customer's cheese.
|
|
54
|
-
//
|
|
55
|
-
// TODO: Move customers cheese by not appending the default port for https.
|
|
56
|
-
if (port && port !== DEFAULT_PORT) {
|
|
53
|
+
if (port && port !== defaultPort) {
|
|
57
54
|
hostname += ':' + port
|
|
58
55
|
}
|
|
59
56
|
|
|
@@ -159,8 +156,7 @@ module.exports = function instrumentOutbound(agent, opts, makeRequest) {
|
|
|
159
156
|
* @param {TraceSegment} segment
|
|
160
157
|
* @param {http.ClientRequest} req
|
|
161
158
|
* @param {Error} error
|
|
162
|
-
*
|
|
163
|
-
* @return {bool} True if the error will be collected by New Relic.
|
|
159
|
+
* @returns {bool} True if the error will be collected by New Relic.
|
|
164
160
|
*/
|
|
165
161
|
function handleError(segment, req, error) {
|
|
166
162
|
if (req.listenerCount('error') > 0) {
|
|
File without changes
|
|
@@ -27,16 +27,7 @@ module.exports = function initialize(agent, hapi, moduleName, shim) {
|
|
|
27
27
|
} else if (hapi.Server) {
|
|
28
28
|
// Server.connection was removed in v17
|
|
29
29
|
if (!hapi.Server.prototype.connection) {
|
|
30
|
-
return require('./hapi/hapi
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// See if we can find the plugin class. This should be the super class of
|
|
34
|
-
// Server and will cover more scenarios.
|
|
35
|
-
const Plugin = hapi.Server.super_
|
|
36
|
-
if (_isPluginClass(Plugin)) {
|
|
37
|
-
wrapServer(shim, Plugin)
|
|
38
|
-
} else {
|
|
39
|
-
wrapServer(shim, hapi.Server)
|
|
30
|
+
return require('./hapi/hapi')(agent, hapi, moduleName, shim)
|
|
40
31
|
}
|
|
41
32
|
}
|
|
42
33
|
}
|
|
@@ -251,19 +242,6 @@ function wrapMiddleware(shim, middleware, event) {
|
|
|
251
242
|
return shim.recordMiddleware(middleware, spec)
|
|
252
243
|
}
|
|
253
244
|
|
|
254
|
-
function _isPluginClass(Plugin) {
|
|
255
|
-
if (typeof Plugin !== 'function' || !Plugin.prototype) {
|
|
256
|
-
return false
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
const proto = Plugin.prototype
|
|
260
|
-
return (
|
|
261
|
-
typeof proto.handler === 'function' &&
|
|
262
|
-
typeof proto.route === 'function' &&
|
|
263
|
-
typeof proto.ext === 'function'
|
|
264
|
-
)
|
|
265
|
-
}
|
|
266
|
-
|
|
267
245
|
function wrapReply(wrap, reply, isPreHandler) {
|
|
268
246
|
const isFinal = !isPreHandler
|
|
269
247
|
// The only reply method that is actually used by pre-handlers is `response`. All
|
|
@@ -5,8 +5,6 @@
|
|
|
5
5
|
|
|
6
6
|
'use strict'
|
|
7
7
|
|
|
8
|
-
const semver = require('semver')
|
|
9
|
-
|
|
10
8
|
function getQuery(shim, original, name, args) {
|
|
11
9
|
const config = args[0]
|
|
12
10
|
let statement
|
|
@@ -22,12 +20,10 @@ function getQuery(shim, original, name, args) {
|
|
|
22
20
|
}
|
|
23
21
|
|
|
24
22
|
module.exports = function initialize(agent, pgsql, moduleName, shim) {
|
|
25
|
-
const pgVersion = shim.require('./package.json').version
|
|
26
|
-
|
|
27
23
|
shim.setDatastore(shim.POSTGRES)
|
|
24
|
+
|
|
28
25
|
// allows for native wrapping to not happen if not necessary
|
|
29
26
|
// when env var is true
|
|
30
|
-
|
|
31
27
|
if (process.env.NODE_PG_FORCE_NATIVE) {
|
|
32
28
|
return instrumentPGNative(pgsql)
|
|
33
29
|
}
|
|
@@ -36,7 +32,7 @@ module.exports = function initialize(agent, pgsql, moduleName, shim) {
|
|
|
36
32
|
// As of pg v7.0.0, Client.query returns a Promise from an async call.
|
|
37
33
|
// pg supports event based Client.query when a Query object is passed in,
|
|
38
34
|
// and works similarly in pg version <7.0.0
|
|
39
|
-
if (
|
|
35
|
+
if (typeof queryArgs[0] === 'string') {
|
|
40
36
|
return {
|
|
41
37
|
callback: shim.LAST,
|
|
42
38
|
query: getQuery,
|
|
@@ -58,18 +54,7 @@ module.exports = function initialize(agent, pgsql, moduleName, shim) {
|
|
|
58
54
|
// wrapping for native
|
|
59
55
|
function instrumentPGNative(pg) {
|
|
60
56
|
shim.wrapReturn(pg, 'Client', clientFactoryWrapper)
|
|
61
|
-
shim.
|
|
62
|
-
|
|
63
|
-
// In pg v5 the Client class used by pg-pool is the same Client
|
|
64
|
-
// class as pg.Client. Since querying through the Pool class just
|
|
65
|
-
// defers to Client.query in this case we should skip instrumenting
|
|
66
|
-
// the Client class on Pool.
|
|
67
|
-
// Note: pg v5 was the only version to have both the Pool
|
|
68
|
-
// constructor and pg.pools so we can check against pg.pools to only
|
|
69
|
-
// instrument pg.Pool on v6 and later.
|
|
70
|
-
if (!pg.pools) {
|
|
71
|
-
shim.wrapClass(pg, 'Pool', { post: poolPostConstructor, es6: true })
|
|
72
|
-
}
|
|
57
|
+
shim.wrapClass(pg, 'Pool', { post: poolPostConstructor, es6: true })
|
|
73
58
|
}
|
|
74
59
|
|
|
75
60
|
function poolPostConstructor(shim) {
|
package/lib/instrumentations.js
CHANGED
|
@@ -21,7 +21,6 @@ module.exports = function instrumentations() {
|
|
|
21
21
|
'generic-pool': { type: MODULE_TYPE.GENERIC },
|
|
22
22
|
'@grpc/grpc-js': { module: './instrumentation/grpc-js' },
|
|
23
23
|
'@hapi/hapi': { type: MODULE_TYPE.WEB_FRAMEWORK },
|
|
24
|
-
'hapi': { type: MODULE_TYPE.WEB_FRAMEWORK },
|
|
25
24
|
'ioredis': { type: MODULE_TYPE.DATASTORE },
|
|
26
25
|
'koa': { module: '@newrelic/koa' },
|
|
27
26
|
'memcached': { type: MODULE_TYPE.DATASTORE },
|
|
@@ -36,7 +35,6 @@ module.exports = function instrumentations() {
|
|
|
36
35
|
'restify': { type: MODULE_TYPE.WEB_FRAMEWORK },
|
|
37
36
|
'superagent': { module: '@newrelic/superagent' },
|
|
38
37
|
'undici': { type: MODULE_TYPE.TRANSACTION },
|
|
39
|
-
'oracle': { type: null },
|
|
40
38
|
'vision': { type: MODULE_TYPE.WEB_FRAMEWORK },
|
|
41
39
|
'when': { type: null },
|
|
42
40
|
'winston': { type: MODULE_TYPE.GENERIC }
|
package/lib/metrics/names.js
CHANGED
|
@@ -147,13 +147,6 @@ const CASSANDRA = {
|
|
|
147
147
|
ALL: DB.PREFIX + 'Cassandra/' + ALL
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
-
const ORACLE = {
|
|
151
|
-
PREFIX: 'Oracle',
|
|
152
|
-
STATEMENT: DB.STATEMENT + '/Oracle/',
|
|
153
|
-
OPERATION: DB.OPERATION + '/Oracle/',
|
|
154
|
-
INSTANCE: DB.INSTANCE + '/Oracle/'
|
|
155
|
-
}
|
|
156
|
-
|
|
157
150
|
const EXPRESS = {
|
|
158
151
|
PREFIX: 'Expressjs/',
|
|
159
152
|
MIDDLEWARE: MIDDLEWARE.PREFIX + 'Expressjs/',
|
|
@@ -329,7 +322,6 @@ module.exports = {
|
|
|
329
322
|
MYSQL: MYSQL,
|
|
330
323
|
NODEJS: NODEJS,
|
|
331
324
|
NORMALIZED: 'NormalizedUri',
|
|
332
|
-
ORACLE: ORACLE,
|
|
333
325
|
OTHER_TRANSACTION: OTHER_TRANSACTION,
|
|
334
326
|
POSTGRES: POSTGRES,
|
|
335
327
|
QUEUETIME: 'WebFrontend/QueueTime',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "newrelic",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.0.0",
|
|
4
4
|
"author": "New Relic Node.js agent team <nodejs@newrelic.com>",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"contributors": [
|
|
@@ -108,6 +108,11 @@
|
|
|
108
108
|
"name": "Diana Thayer",
|
|
109
109
|
"email": "dthayer@newrelic.com",
|
|
110
110
|
"web": "https://newrelic.com"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"name": "Jordi Gutiérrez Hermoso",
|
|
114
|
+
"email": "jgutierrezhermoso@newrelic.com",
|
|
115
|
+
"web": "https://newrelic.com"
|
|
111
116
|
}
|
|
112
117
|
],
|
|
113
118
|
"description": "New Relic agent",
|
|
@@ -121,7 +126,7 @@
|
|
|
121
126
|
],
|
|
122
127
|
"homepage": "https://github.com/newrelic/node-newrelic",
|
|
123
128
|
"engines": {
|
|
124
|
-
"node": ">=
|
|
129
|
+
"node": ">=14",
|
|
125
130
|
"npm": ">=6.0.0"
|
|
126
131
|
},
|
|
127
132
|
"directories": {
|
|
@@ -129,11 +134,10 @@
|
|
|
129
134
|
},
|
|
130
135
|
"scripts": {
|
|
131
136
|
"bench": "node ./bin/run-bench.js",
|
|
132
|
-
"ca-gen": "./bin/update-ca-bundle.sh",
|
|
133
137
|
"docker-env": "./bin/docker-env-vars.sh",
|
|
134
138
|
"docs": "npm ci && jsdoc -c ./jsdoc-conf.json --private -r .",
|
|
135
139
|
"integration": "npm run prepare-test && npm run sub-install && time tap test/integration/**/**/*.tap.js --timeout=180 --no-coverage --reporter classic",
|
|
136
|
-
"prepare-test": "npm run
|
|
140
|
+
"prepare-test": "npm run ssl && npm run docker-env",
|
|
137
141
|
"lint": "eslint ./*.js lib test bin examples",
|
|
138
142
|
"lint:fix": "eslint --fix, ./*.js lib test bin examples",
|
|
139
143
|
"public-docs": "jsdoc -c ./jsdoc-conf.json --tutorials examples/shim api.js lib/shim/ lib/transaction/handle.js && cp examples/shim/*.png out/",
|
|
@@ -161,9 +165,9 @@
|
|
|
161
165
|
"dependencies": {
|
|
162
166
|
"@grpc/grpc-js": "^1.5.5",
|
|
163
167
|
"@grpc/proto-loader": "^0.6.13",
|
|
164
|
-
"@newrelic/aws-sdk": "^
|
|
165
|
-
"@newrelic/koa": "^
|
|
166
|
-
"@newrelic/superagent": "^
|
|
168
|
+
"@newrelic/aws-sdk": "^5.0.0",
|
|
169
|
+
"@newrelic/koa": "^7.0.0",
|
|
170
|
+
"@newrelic/superagent": "^6.0.0",
|
|
167
171
|
"@tyriar/fibonacci-heap": "^2.0.7",
|
|
168
172
|
"async": "^3.2.3",
|
|
169
173
|
"concat-stream": "^2.0.0",
|
|
@@ -174,13 +178,13 @@
|
|
|
174
178
|
"winston-transport": "^4.5.0"
|
|
175
179
|
},
|
|
176
180
|
"optionalDependencies": {
|
|
177
|
-
"@newrelic/native-metrics": "^
|
|
181
|
+
"@newrelic/native-metrics": "^9.0.0"
|
|
178
182
|
},
|
|
179
183
|
"devDependencies": {
|
|
180
184
|
"@newrelic/eslint-config": "^0.0.3",
|
|
181
185
|
"@newrelic/newrelic-oss-cli": "^0.1.2",
|
|
182
186
|
"@newrelic/proxy": "^2.0.0",
|
|
183
|
-
"@newrelic/test-utilities": "^
|
|
187
|
+
"@newrelic/test-utilities": "^7.0.0",
|
|
184
188
|
"@octokit/rest": "^18.0.15",
|
|
185
189
|
"@slack/bolt": "^3.7.0",
|
|
186
190
|
"ajv": "^6.12.6",
|