newrelic 8.0.0 → 8.1.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 +15 -0
- package/THIRD_PARTY_NOTICES.md +28 -75
- package/bin/test-naming-rules.js +0 -1
- package/bin/tracetractor +0 -1
- package/lib/agent.js +51 -31
- package/lib/collector/api.js +2 -3
- package/lib/instrumentation/fastify/spec-builders.js +5 -0
- package/lib/instrumentation/fastify.js +5 -0
- package/lib/instrumentation/mongodb/common.js +186 -0
- package/lib/instrumentation/mongodb/constants.js +97 -0
- package/lib/instrumentation/mongodb/v2-mongo.js +108 -0
- package/lib/instrumentation/mongodb/v3-mongo.js +61 -0
- package/lib/instrumentation/mongodb/v4-mongo.js +96 -0
- package/lib/instrumentation/mongodb.js +17 -310
- package/lib/instrumentation/pg.js +35 -16
- package/package.json +9 -3
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
|
|
6
6
|
'use strict'
|
|
7
7
|
|
|
8
|
+
const semver = require('semver')
|
|
9
|
+
|
|
8
10
|
function getQuery(shim, original, name, args) {
|
|
9
11
|
var config = args[0]
|
|
10
12
|
var statement
|
|
@@ -20,6 +22,8 @@ function getQuery(shim, original, name, args) {
|
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
module.exports = function initialize(agent, pgsql, moduleName, shim) {
|
|
25
|
+
const pgVersion = shim.require('./package.json').version
|
|
26
|
+
|
|
23
27
|
shim.setDatastore(shim.POSTGRES)
|
|
24
28
|
// allows for native wrapping to not happen if not necessary
|
|
25
29
|
// when env var is true
|
|
@@ -28,6 +32,30 @@ module.exports = function initialize(agent, pgsql, moduleName, shim) {
|
|
|
28
32
|
return instrumentPGNative(pgsql)
|
|
29
33
|
}
|
|
30
34
|
|
|
35
|
+
function wrapJSClientQuery(shim, _, __, queryArgs) {
|
|
36
|
+
// As of pg v7.0.0, Client.query returns a Promise from an async call.
|
|
37
|
+
// pg supports event based Client.query when a Query object is passed in,
|
|
38
|
+
// and works similarly in pg version <7.0.0
|
|
39
|
+
if (semver.satisfies(pgVersion, '>=7.0.0') &&
|
|
40
|
+
typeof queryArgs[0] === 'string') {
|
|
41
|
+
return {
|
|
42
|
+
callback: shim.LAST,
|
|
43
|
+
query: getQuery,
|
|
44
|
+
promise: true,
|
|
45
|
+
parameters: getInstanceParameters(shim, this),
|
|
46
|
+
internal: false
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return {
|
|
51
|
+
callback: shim.LAST,
|
|
52
|
+
query: getQuery,
|
|
53
|
+
stream: 'row',
|
|
54
|
+
parameters: getInstanceParameters(shim, this),
|
|
55
|
+
internal: false
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
31
59
|
// wrapping for native
|
|
32
60
|
function instrumentPGNative(pg) {
|
|
33
61
|
shim.wrapReturn(pg, 'Client', clientFactoryWrapper)
|
|
@@ -56,13 +84,11 @@ module.exports = function initialize(agent, pgsql, moduleName, shim) {
|
|
|
56
84
|
}
|
|
57
85
|
|
|
58
86
|
function clientPostConstructor(shim) {
|
|
59
|
-
shim.recordQuery(
|
|
60
|
-
|
|
61
|
-
query
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
internal: false
|
|
65
|
-
})
|
|
87
|
+
shim.recordQuery(
|
|
88
|
+
this,
|
|
89
|
+
'query',
|
|
90
|
+
wrapJSClientQuery
|
|
91
|
+
)
|
|
66
92
|
|
|
67
93
|
shim.record(this, 'connect', function pgConnectNamer() {
|
|
68
94
|
return {
|
|
@@ -93,18 +119,11 @@ module.exports = function initialize(agent, pgsql, moduleName, shim) {
|
|
|
93
119
|
shim.recordQuery(
|
|
94
120
|
pgsql && pgsql.Client && pgsql.Client.prototype,
|
|
95
121
|
'query',
|
|
96
|
-
|
|
97
|
-
return {
|
|
98
|
-
callback: shim.LAST,
|
|
99
|
-
query: getQuery,
|
|
100
|
-
stream: 'row',
|
|
101
|
-
parameters: getInstanceParameters(shim, this),
|
|
102
|
-
internal: false
|
|
103
|
-
}
|
|
104
|
-
}
|
|
122
|
+
wrapJSClientQuery
|
|
105
123
|
)
|
|
106
124
|
}
|
|
107
125
|
|
|
126
|
+
|
|
108
127
|
function getInstanceParameters(shim, client) {
|
|
109
128
|
return {
|
|
110
129
|
host: client.host || null,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "newrelic",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.1.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,7 +114,7 @@
|
|
|
109
114
|
"debugging",
|
|
110
115
|
"profiling"
|
|
111
116
|
],
|
|
112
|
-
"homepage": "
|
|
117
|
+
"homepage": "https://github.com/newrelic/node-newrelic",
|
|
113
118
|
"engines": {
|
|
114
119
|
"node": ">=12.0.0",
|
|
115
120
|
"npm": ">=6.0.0"
|
|
@@ -170,7 +175,8 @@
|
|
|
170
175
|
"bluebird": "^3.4.7",
|
|
171
176
|
"chai": "^4.1.2",
|
|
172
177
|
"commander": "^7.0.0",
|
|
173
|
-
"eslint": "^
|
|
178
|
+
"eslint": "^7.32.0",
|
|
179
|
+
"eslint-plugin-header": "^3.1.1",
|
|
174
180
|
"express": "*",
|
|
175
181
|
"fastify": "^2.15.3",
|
|
176
182
|
"generic-pool": "^3.6.1",
|