newrelic 8.13.1 → 8.14.1
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 +45 -23
- package/THIRD_PARTY_NOTICES.md +2 -2
- package/api.js +14 -7
- package/lib/aggregators/log-aggregator.js +4 -4
- package/lib/instrumentation/@grpc/grpc-js.js +10 -0
- package/lib/instrumentation/@node-redis/client.js +1 -1
- package/lib/instrumentation/pino/pino.js +32 -36
- package/lib/instrumentation/winston.js +2 -2
- package/lib/instrumentations.js +1 -0
- package/package.json +3 -3
package/NEWS.md
CHANGED
|
@@ -1,35 +1,57 @@
|
|
|
1
|
-
### v8.
|
|
1
|
+
### v8.14.1 (2022-06-09)
|
|
2
2
|
|
|
3
|
-
*
|
|
3
|
+
* Added defensive code in redis v4 instrumentation to check for `opts.socket` first before evaluating `opts.socket.path`.
|
|
4
|
+
Thanks @RAshidAZ for your contribution!
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
* Updated `@grpc/proto-loader` to v0.6.13 to pickup security fixes in protobufjs.
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
### v8.14.0 (2022-06-06)
|
|
8
9
|
|
|
9
|
-
*
|
|
10
|
+
* Fixed issue with `api.getBrowserTimingHeader` optional script unwrapping issue with util.format.
|
|
11
|
+
Thanks for your contribution @github-dd-nicolas 🎉
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
* Fixed winston instrumentation to not exit early when `winston.createLogger` is created without options.
|
|
12
14
|
|
|
13
|
-
*
|
|
15
|
+
* Updated pino instrumentation to not override user log configurations.
|
|
14
16
|
|
|
15
|
-
|
|
17
|
+
### v8.13.2 (2022-05-31)
|
|
16
18
|
|
|
17
|
-
*
|
|
18
|
-
|
|
19
|
-
Thanks to @github-dd-nicolas for the contribution. 🎉
|
|
20
|
-
|
|
21
|
-
* Upgraded `@grpc/proto-loader` to fix a [CVE](https://security.snyk.io/vuln/SNYK-JS-PROTOBUFJS-2441248) with `protobufjs`.
|
|
22
|
-
|
|
23
|
-
* Upgraded `@newrelic/test-utilities` to resolve a dev-only audit warning.
|
|
24
|
-
|
|
25
|
-
### v8.11.2 (2022-05-23)
|
|
26
|
-
|
|
27
|
-
* Fixed winston instrumentation to no longer coerce every log line to be json.
|
|
28
|
-
|
|
29
|
-
### v8.11.1 (2022-05-13)
|
|
30
|
-
|
|
31
|
-
* Fixed an issue with winston instrumentation that caused agent to crash when creating a winston logger from an existing instantiated logger.
|
|
19
|
+
* Upgraded `protobufjs` to resolve CVE-2022-25878
|
|
32
20
|
|
|
21
|
+
### v8.13.1 (2022-05-27)
|
|
22
|
+
|
|
23
|
+
* Fixed passing undefined as a formatter options to `winston.format.combine`
|
|
24
|
+
|
|
25
|
+
Thanks to Rana Mohammad (@rjmohammad) for the contribution. 🎉
|
|
26
|
+
|
|
27
|
+
### v8.13.0 (2022-05-26)
|
|
28
|
+
|
|
29
|
+
* Moved log forwarding logic to a transport so customer transports are not polluted with NR linking metadata and timestamp and error manipulations.
|
|
30
|
+
|
|
31
|
+
* Prevented transmitting logs when application level logging has been disabled.
|
|
32
|
+
|
|
33
|
+
### v8.12.0 (2022-05-24)
|
|
34
|
+
|
|
35
|
+
* Added instrumentation to pino to support application logging use cases: forwarding, local decorating, and metrics.
|
|
36
|
+
|
|
37
|
+
* Added supportability metrics about the data usage bytes of harvested data to the collector endpoints.
|
|
38
|
+
|
|
39
|
+
* Added an optional way to avoid wrapping browser agent script with <script> tag when using `api.getBrowserTimingHeader`. This will ease usage with Component based libraries like React.
|
|
40
|
+
|
|
41
|
+
Thanks to @github-dd-nicolas for the contribution. 🎉
|
|
42
|
+
|
|
43
|
+
* Upgraded `@grpc/proto-loader` to fix a [CVE](https://security.snyk.io/vuln/SNYK-JS-PROTOBUFJS-2441248) with `protobufjs`.
|
|
44
|
+
|
|
45
|
+
* Upgraded `@newrelic/test-utilities` to resolve a dev-only audit warning.
|
|
46
|
+
|
|
47
|
+
### v8.11.2 (2022-05-23)
|
|
48
|
+
|
|
49
|
+
* Fixed winston instrumentation to no longer coerce every log line to be json.
|
|
50
|
+
|
|
51
|
+
### v8.11.1 (2022-05-13)
|
|
52
|
+
|
|
53
|
+
* Fixed an issue with winston instrumentation that caused agent to crash when creating a winston logger from an existing instantiated logger.
|
|
54
|
+
|
|
33
55
|
### v8.11.0 (2022-05-11)
|
|
34
56
|
|
|
35
57
|
* Added application logging for Winston in the Node.js agent
|
package/THIRD_PARTY_NOTICES.md
CHANGED
|
@@ -296,7 +296,7 @@ This product includes source derived from [@grpc/grpc-js](https://github.com/grp
|
|
|
296
296
|
|
|
297
297
|
### @grpc/proto-loader
|
|
298
298
|
|
|
299
|
-
This product includes source derived from [@grpc/proto-loader](https://github.com/grpc/grpc-node) ([v0.6.
|
|
299
|
+
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):
|
|
300
300
|
|
|
301
301
|
```
|
|
302
302
|
Apache License
|
|
@@ -1801,7 +1801,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
|
|
1801
1801
|
|
|
1802
1802
|
### @newrelic/test-utilities
|
|
1803
1803
|
|
|
1804
|
-
This product includes source derived from [@newrelic/test-utilities](https://github.com/newrelic/node-test-utilities) ([v6.5.
|
|
1804
|
+
This product includes source derived from [@newrelic/test-utilities](https://github.com/newrelic/node-test-utilities) ([v6.5.5](https://github.com/newrelic/node-test-utilities/tree/v6.5.5)), distributed under the [Apache-2.0 License](https://github.com/newrelic/node-test-utilities/blob/v6.5.5/LICENSE):
|
|
1805
1805
|
|
|
1806
1806
|
```
|
|
1807
1807
|
Apache License
|
package/api.js
CHANGED
|
@@ -27,8 +27,9 @@ const NAMES = require('./lib/metrics/names')
|
|
|
27
27
|
* CONSTANTS
|
|
28
28
|
*
|
|
29
29
|
*/
|
|
30
|
-
const RUM_STUB = 'window.NREUM||(NREUM={});NREUM.info = %s;'
|
|
31
|
-
const RUM_STUB_SHELL = `<script type='text/javascript'
|
|
30
|
+
const RUM_STUB = 'window.NREUM||(NREUM={});NREUM.info = %s; %s'
|
|
31
|
+
const RUM_STUB_SHELL = `<script type='text/javascript'>${RUM_STUB}</script>`
|
|
32
|
+
const RUM_STUB_SHELL_WITH_NONCE_PARAM = `<script type='text/javascript' %s>${RUM_STUB}</script>`
|
|
32
33
|
|
|
33
34
|
// these messages are used in the _gracefail() method below in getBrowserTimingHeader
|
|
34
35
|
const RUM_ISSUES = [
|
|
@@ -653,12 +654,18 @@ API.prototype.getBrowserTimingHeader = function getBrowserTimingHeader(options)
|
|
|
653
654
|
const tabs = config.browser_monitoring.debug ? 2 : 0
|
|
654
655
|
const json = JSON.stringify(rumHash, null, tabs)
|
|
655
656
|
|
|
656
|
-
// set nonce attribute if passed in options
|
|
657
|
-
const nonce = options && options.nonce ? 'nonce="' + options.nonce + '"' : ''
|
|
658
|
-
const script = options && options.hasToRemoveScriptWrapper ? RUM_STUB : RUM_STUB_SHELL
|
|
659
|
-
|
|
660
657
|
// the complete header to be written to the browser
|
|
661
|
-
const out =
|
|
658
|
+
const out =
|
|
659
|
+
options && options.hasToRemoveScriptWrapper
|
|
660
|
+
? util.format(RUM_STUB, json, jsAgentLoader)
|
|
661
|
+
: options && options.nonce
|
|
662
|
+
? util.format(
|
|
663
|
+
RUM_STUB_SHELL_WITH_NONCE_PARAM,
|
|
664
|
+
'nonce="' + options.nonce + '"',
|
|
665
|
+
json,
|
|
666
|
+
jsAgentLoader
|
|
667
|
+
)
|
|
668
|
+
: util.format(RUM_STUB_SHELL, json, jsAgentLoader)
|
|
662
669
|
|
|
663
670
|
logger.trace('generating RUM header', out)
|
|
664
671
|
|
|
@@ -38,12 +38,12 @@ class LogAggregator extends EventAggregator {
|
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
40
|
* Due to logging library implementation details
|
|
41
|
-
* some log lines are
|
|
42
|
-
*
|
|
41
|
+
* some "log lines" are a function that formats the
|
|
42
|
+
* data accordingly into an Object, I know, this sucks.
|
|
43
43
|
*/
|
|
44
44
|
const formattedLogs = logs.map((logLine) => {
|
|
45
|
-
if (typeof logLine === '
|
|
46
|
-
return
|
|
45
|
+
if (typeof logLine === 'function') {
|
|
46
|
+
return logLine()
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
return logLine
|
|
@@ -54,7 +54,7 @@ module.exports = function initialize(agent, redis, moduleName, shim) {
|
|
|
54
54
|
function getRedisParams(opts) {
|
|
55
55
|
return {
|
|
56
56
|
host: (opts.socket && opts.socket.host) || 'localhost',
|
|
57
|
-
port_path_or_id: (opts.socket && opts.socket.path
|
|
57
|
+
port_path_or_id: (opts.socket && (opts.socket.path || opts.socket.port)) || '6379',
|
|
58
58
|
database_name: opts.database || 0
|
|
59
59
|
}
|
|
60
60
|
}
|
|
@@ -49,20 +49,6 @@ module.exports = function instrument(shim) {
|
|
|
49
49
|
|
|
50
50
|
const symbols = shim.require('./lib/symbols')
|
|
51
51
|
|
|
52
|
-
/**
|
|
53
|
-
* Wraps the level cache so we can properly set a formatter to return the
|
|
54
|
-
* label as level in log line instead of number
|
|
55
|
-
*/
|
|
56
|
-
shim.wrap(levelUtils, 'genLsCache', function genLsCache(shim, genLevelsCache) {
|
|
57
|
-
return function wrappedGenLsCache() {
|
|
58
|
-
const args = shim.argsToArray.apply(shim, arguments)
|
|
59
|
-
args[0][symbols.formattersSym].level = function nrLevelMapping(label) {
|
|
60
|
-
return { level: label }
|
|
61
|
-
}
|
|
62
|
-
return genLevelsCache.apply(this, args)
|
|
63
|
-
}
|
|
64
|
-
})
|
|
65
|
-
|
|
66
52
|
shim.wrap(tools, 'asJson', function wrapJson(shim, asJson) {
|
|
67
53
|
/**
|
|
68
54
|
* Wraps function in pino that is used to construct/serialize a log
|
|
@@ -75,27 +61,14 @@ module.exports = function instrument(shim) {
|
|
|
75
61
|
* @returns {string} serialized log line
|
|
76
62
|
*/
|
|
77
63
|
return function wrappedAsJson() {
|
|
78
|
-
// overriding the symbol that defines the key for message(pino defaults this to `msg`)
|
|
79
|
-
this[symbols.messageKeySym] = 'message'
|
|
80
|
-
|
|
81
64
|
const args = shim.argsToArray.apply(shim, arguments)
|
|
82
65
|
|
|
83
|
-
/**
|
|
84
|
-
* changing the label from time to timestamp
|
|
85
|
-
* and assign unix timestamp to match our specification
|
|
86
|
-
*/
|
|
87
|
-
args[3] = `,"timestamp":${Date.now()}`
|
|
88
|
-
|
|
89
66
|
if (isMetricsEnabled(config)) {
|
|
90
67
|
const level = args[2]
|
|
91
68
|
incrementLoggingLinesMetrics(levelMap[level], metrics)
|
|
92
69
|
}
|
|
93
70
|
|
|
94
|
-
if (
|
|
95
|
-
const metadata = agent.getLinkingMetadata()
|
|
96
|
-
const chindings = this[symbols.chindingsSym]
|
|
97
|
-
reformatLogLine(args[0], metadata, chindings)
|
|
98
|
-
} else if (isLocalDecoratingEnabled(config)) {
|
|
71
|
+
if (isLocalDecoratingEnabled(config)) {
|
|
99
72
|
args[1] += agent.getNRLinkingMetadata()
|
|
100
73
|
}
|
|
101
74
|
|
|
@@ -107,7 +80,10 @@ module.exports = function instrument(shim) {
|
|
|
107
80
|
const logLine = asJson.apply(this, args)
|
|
108
81
|
|
|
109
82
|
if (isLogForwardingEnabled(config, agent)) {
|
|
110
|
-
|
|
83
|
+
const chindings = this[symbols.chindingsSym]
|
|
84
|
+
const formatLogLine = reformatLogLine({ msg: args[1], logLine, agent, chindings, levelMap })
|
|
85
|
+
|
|
86
|
+
agent.logs.add(formatLogLine)
|
|
111
87
|
}
|
|
112
88
|
|
|
113
89
|
return logLine
|
|
@@ -119,14 +95,18 @@ module.exports = function instrument(shim) {
|
|
|
119
95
|
* reformats error and assigns NR context data
|
|
120
96
|
* to log line
|
|
121
97
|
*
|
|
98
|
+
* @param logLine.logLine
|
|
122
99
|
* @param {object} logLine log line
|
|
123
100
|
* @param {object} metadata NR context data
|
|
124
101
|
* @param {string} chindings serialized string of all common log line data
|
|
102
|
+
* @param logLine.args
|
|
103
|
+
* @param logLine.agent
|
|
104
|
+
* @param logLine.chindings
|
|
105
|
+
* @param logLine.msg
|
|
106
|
+
* @param logLine.levelMap
|
|
125
107
|
*/
|
|
126
|
-
function reformatLogLine(logLine,
|
|
127
|
-
|
|
128
|
-
reformatError(logLine)
|
|
129
|
-
}
|
|
108
|
+
function reformatLogLine({ logLine, msg, agent, chindings = '', levelMap }) {
|
|
109
|
+
const metadata = agent.getLinkingMetadata()
|
|
130
110
|
|
|
131
111
|
/**
|
|
132
112
|
* pino adds this already for us at times
|
|
@@ -137,7 +117,24 @@ function reformatLogLine(logLine, metadata, chindings = '') {
|
|
|
137
117
|
delete metadata.hostname
|
|
138
118
|
}
|
|
139
119
|
|
|
140
|
-
Object.assign(
|
|
120
|
+
const agentMeta = Object.assign({}, { timestamp: Date.now(), message: msg }, metadata)
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* A function that gets executed in `_toPayloadSync` of log aggregator.
|
|
124
|
+
* This will parse the serialized log line and then add the relevant NR
|
|
125
|
+
* context metadata and rename the time/msg keys to timestamp/message
|
|
126
|
+
*/
|
|
127
|
+
return function formatLogLine() {
|
|
128
|
+
const formattedLog = JSON.parse(logLine)
|
|
129
|
+
if (formattedLog.err) {
|
|
130
|
+
reformatError(formattedLog)
|
|
131
|
+
}
|
|
132
|
+
Object.assign(formattedLog, agentMeta)
|
|
133
|
+
formattedLog.level = levelMap[formattedLog.level]
|
|
134
|
+
delete formattedLog.time
|
|
135
|
+
delete formattedLog.msg
|
|
136
|
+
return formattedLog
|
|
137
|
+
}
|
|
141
138
|
}
|
|
142
139
|
|
|
143
140
|
/**
|
|
@@ -150,7 +147,6 @@ function reformatLogLine(logLine, metadata, chindings = '') {
|
|
|
150
147
|
function reformatError(logLine) {
|
|
151
148
|
logLine['error.message'] = truncate(logLine.err.message)
|
|
152
149
|
logLine['error.stack'] = truncate(logLine.err.stack)
|
|
153
|
-
logLine['error.class'] =
|
|
154
|
-
logLine.err.name === 'Error' ? logLine.err.constructor.name : logLine.err.name
|
|
150
|
+
logLine['error.class'] = logLine.err.type
|
|
155
151
|
delete logLine.err
|
|
156
152
|
}
|
|
@@ -29,8 +29,8 @@ module.exports = function instrument(agent, winston, _, shim) {
|
|
|
29
29
|
shim.wrap(winston, 'createLogger', function wrapCreate(shim, createLogger) {
|
|
30
30
|
return function createWrappedLogger() {
|
|
31
31
|
const args = shim.argsToArray.apply(shim, arguments)
|
|
32
|
-
const opts = args[0]
|
|
33
|
-
if (
|
|
32
|
+
const opts = args[0] || {}
|
|
33
|
+
if (isStream(opts)) {
|
|
34
34
|
return createLogger.apply(this, args)
|
|
35
35
|
}
|
|
36
36
|
|
package/lib/instrumentations.js
CHANGED
|
@@ -19,6 +19,7 @@ module.exports = function instrumentations() {
|
|
|
19
19
|
'express': { type: MODULE_TYPE.WEB_FRAMEWORK },
|
|
20
20
|
'fastify': { type: MODULE_TYPE.WEB_FRAMEWORK },
|
|
21
21
|
'generic-pool': { type: MODULE_TYPE.GENERIC },
|
|
22
|
+
'@grpc/grpc-js': { type: MODULE_TYPE.GENERIC },
|
|
22
23
|
'@hapi/hapi': { type: MODULE_TYPE.WEB_FRAMEWORK },
|
|
23
24
|
'hapi': { type: MODULE_TYPE.WEB_FRAMEWORK },
|
|
24
25
|
'ioredis': { type: MODULE_TYPE.DATASTORE },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "newrelic",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.14.1",
|
|
4
4
|
"author": "New Relic Node.js agent team <nodejs@newrelic.com>",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"contributors": [
|
|
@@ -160,7 +160,7 @@
|
|
|
160
160
|
},
|
|
161
161
|
"dependencies": {
|
|
162
162
|
"@grpc/grpc-js": "^1.5.5",
|
|
163
|
-
"@grpc/proto-loader": "^0.6.
|
|
163
|
+
"@grpc/proto-loader": "^0.6.13",
|
|
164
164
|
"@newrelic/aws-sdk": "^4.1.1",
|
|
165
165
|
"@newrelic/koa": "^6.1.1",
|
|
166
166
|
"@newrelic/superagent": "^5.1.0",
|
|
@@ -180,7 +180,7 @@
|
|
|
180
180
|
"@newrelic/eslint-config": "^0.0.3",
|
|
181
181
|
"@newrelic/newrelic-oss-cli": "^0.1.2",
|
|
182
182
|
"@newrelic/proxy": "^2.0.0",
|
|
183
|
-
"@newrelic/test-utilities": "^6.5.
|
|
183
|
+
"@newrelic/test-utilities": "^6.5.5",
|
|
184
184
|
"@octokit/rest": "^18.0.15",
|
|
185
185
|
"@slack/bolt": "^3.7.0",
|
|
186
186
|
"ajv": "^6.12.6",
|