newrelic 9.8.0 → 9.8.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 +8 -2
- package/README.md +1 -1
- package/THIRD_PARTY_NOTICES.md +29 -0
- package/lib/instrumentation/winston.js +46 -12
- package/lib/utilization/gcp-info.js +5 -2
- package/package.json +2 -1
package/NEWS.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
### v9.8.1 (2023-01-25)
|
|
2
|
+
|
|
3
|
+
* Changed GCP metadata parsing to use `json-bigint` to avoid loss of precision from numerical instance ID.
|
|
4
|
+
|
|
5
|
+
* Instrumented `winston.loggers.add` so it works like `winston.createLogger`.
|
|
6
|
+
|
|
1
7
|
### v9.8.0 (2023-01-17)
|
|
2
8
|
|
|
3
9
|
* Updated `getBrowserTimingHeader` to allow Browser Agent to be generated even when not in a Transaction by adding `allowTransactionlessInjection` to function options. `allowTransactionlessInjection` is a boolean option, and when set to `true`, will allow injection of the Browser Agent when not in a transaction. This is intended to be used in frameworks that build Static Site Generation(SSG). Note that if you are using this option, you may need to wait until the Node agent has established a connection before calling `getBrowserTimingHeader`. To wait until the agent is connected, you can add the following check to your code:
|
|
@@ -3168,7 +3174,7 @@ Special thanks to Ryan Copley (@RyanCopley) for the contribution.
|
|
|
3168
3174
|
used for instrumenting web frameworks like `restify` or `express`.
|
|
3169
3175
|
|
|
3170
3176
|
Documentation and tutorials for the new API can be found on our GitHub
|
|
3171
|
-
documentation page: http://newrelic.github.io/node-newrelic/
|
|
3177
|
+
documentation page: http://newrelic.github.io/node-newrelic/
|
|
3172
3178
|
|
|
3173
3179
|
* Rewrote built-in instrumentation using the new `Shim` classes.
|
|
3174
3180
|
|
|
@@ -3257,7 +3263,7 @@ Special thanks to Ryan Copley (@RyanCopley) for the contribution.
|
|
|
3257
3263
|
meaning every instrumentation will create Middleware metrics for your server.
|
|
3258
3264
|
|
|
3259
3265
|
Tutorials on using the new instrumentation shim can be found on our API docs:
|
|
3260
|
-
http://newrelic.github.io/node-newrelic
|
|
3266
|
+
http://newrelic.github.io/node-newrelic/.
|
|
3261
3267
|
|
|
3262
3268
|
* Removed `express_segments` feature flag.
|
|
3263
3269
|
|
package/README.md
CHANGED
|
@@ -199,7 +199,7 @@ Here are some resources for learning more about the agent:
|
|
|
199
199
|
|
|
200
200
|
- [New Relic's official Node.js agent documentation](https://docs.newrelic.com/docs/agents/nodejs-agent)
|
|
201
201
|
|
|
202
|
-
- [Developer docs](http://newrelic.github.io/node-newrelic/
|
|
202
|
+
- [Developer docs](http://newrelic.github.io/node-newrelic/)
|
|
203
203
|
|
|
204
204
|
- [Configuring the agent using `newrelic.js` or environment variables](https://docs.newrelic.com/docs/agents/nodejs-agent/installation-configuration/nodejs-agent-configuration)
|
|
205
205
|
|
package/THIRD_PARTY_NOTICES.md
CHANGED
|
@@ -22,6 +22,7 @@ code, the source code can be found at [https://github.com/newrelic/node-newrelic
|
|
|
22
22
|
* [@tyriar/fibonacci-heap](#tyriarfibonacci-heap)
|
|
23
23
|
* [concat-stream](#concat-stream)
|
|
24
24
|
* [https-proxy-agent](#https-proxy-agent)
|
|
25
|
+
* [json-bigint](#json-bigint)
|
|
25
26
|
* [json-stringify-safe](#json-stringify-safe)
|
|
26
27
|
* [readable-stream](#readable-stream)
|
|
27
28
|
* [semver](#semver)
|
|
@@ -1202,6 +1203,34 @@ The above copyright notice and this permission notice shall be included in all c
|
|
|
1202
1203
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
1203
1204
|
```
|
|
1204
1205
|
|
|
1206
|
+
### json-bigint
|
|
1207
|
+
|
|
1208
|
+
This product includes source derived from [json-bigint](https://github.com/sidorares/json-bigint) ([v1.0.0](https://github.com/sidorares/json-bigint/tree/v1.0.0)), distributed under the [MIT License](https://github.com/sidorares/json-bigint/blob/v1.0.0/LICENSE):
|
|
1209
|
+
|
|
1210
|
+
```
|
|
1211
|
+
The MIT License (MIT)
|
|
1212
|
+
|
|
1213
|
+
Copyright (c) 2013 Andrey Sidorov
|
|
1214
|
+
|
|
1215
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
1216
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
1217
|
+
the Software without restriction, including without limitation the rights to
|
|
1218
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
1219
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
1220
|
+
subject to the following conditions:
|
|
1221
|
+
|
|
1222
|
+
The above copyright notice and this permission notice shall be included in all
|
|
1223
|
+
copies or substantial portions of the Software.
|
|
1224
|
+
|
|
1225
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
1226
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
1227
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
1228
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
1229
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
1230
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
1231
|
+
|
|
1232
|
+
```
|
|
1233
|
+
|
|
1205
1234
|
### json-stringify-safe
|
|
1206
1235
|
|
|
1207
1236
|
This product includes source derived from [json-stringify-safe](https://github.com/isaacs/json-stringify-safe) ([v5.0.1](https://github.com/isaacs/json-stringify-safe/tree/v5.0.1)), distributed under the [ISC License](https://github.com/isaacs/json-stringify-safe/blob/v5.0.1/LICENSE):
|
|
@@ -27,28 +27,62 @@ module.exports = function instrument(agent, winston, _, shim) {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
shim.wrap(winston, 'createLogger', function wrapCreate(shim, createLogger) {
|
|
30
|
-
return function
|
|
30
|
+
return function wrappedCreateLogger() {
|
|
31
31
|
const args = shim.argsToArray.apply(shim, arguments)
|
|
32
32
|
const opts = args[0] || {}
|
|
33
33
|
if (isStream(opts)) {
|
|
34
34
|
return createLogger.apply(this, args)
|
|
35
35
|
}
|
|
36
|
+
return performInstrumentation({
|
|
37
|
+
obj: this,
|
|
38
|
+
args,
|
|
39
|
+
opts,
|
|
40
|
+
agent,
|
|
41
|
+
winston,
|
|
42
|
+
registerLogger: createLogger
|
|
43
|
+
})
|
|
44
|
+
}
|
|
45
|
+
})
|
|
36
46
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
47
|
+
shim.wrap(winston.loggers, 'add', function wrapAdd(shim, add) {
|
|
48
|
+
return function wrappedAdd() {
|
|
49
|
+
const args = shim.argsToArray.apply(shim, arguments)
|
|
50
|
+
const id = args[0]
|
|
51
|
+
const opts = args[1] || {}
|
|
52
|
+
// add does nothing if the logger has already been added, so we
|
|
53
|
+
// have to do the same nothingness here.
|
|
54
|
+
const alreadyAdded = this.loggers.has(id)
|
|
55
|
+
if (alreadyAdded || isStream(opts)) {
|
|
56
|
+
return add.apply(this, args)
|
|
41
57
|
}
|
|
58
|
+
return performInstrumentation({
|
|
59
|
+
obj: this,
|
|
60
|
+
args,
|
|
61
|
+
opts,
|
|
62
|
+
agent,
|
|
63
|
+
winston,
|
|
64
|
+
registerLogger: add
|
|
65
|
+
})
|
|
66
|
+
}
|
|
67
|
+
})
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function performInstrumentation({ obj, args, opts, agent, winston, registerLogger }) {
|
|
71
|
+
const config = agent.config
|
|
42
72
|
|
|
43
|
-
|
|
73
|
+
createModuleUsageMetric('winston', agent.metrics)
|
|
44
74
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
75
|
+
if (isLocalDecoratingEnabled(config) || isMetricsEnabled(config)) {
|
|
76
|
+
registerFormatter({ opts, agent, winston })
|
|
77
|
+
}
|
|
48
78
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
79
|
+
const winstonLogger = registerLogger.apply(obj, args)
|
|
80
|
+
|
|
81
|
+
if (isLogForwardingEnabled(config, agent)) {
|
|
82
|
+
winstonLogger.add(new NrTransport({ agent }))
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return winstonLogger
|
|
52
86
|
}
|
|
53
87
|
|
|
54
88
|
/**
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
const logger = require('../logger.js').child({ component: 'gcp-info' })
|
|
9
9
|
const common = require('./common')
|
|
10
10
|
const NAMES = require('../metrics/names.js')
|
|
11
|
+
const JSONbig = require('json-bigint')({ useNativeBigInt: true })
|
|
11
12
|
let resultDict = null
|
|
12
13
|
|
|
13
14
|
module.exports = fetchGCPInfo
|
|
@@ -37,9 +38,11 @@ function fetchGCPInfo(agent, callback) {
|
|
|
37
38
|
if (err) {
|
|
38
39
|
return callback(err)
|
|
39
40
|
}
|
|
40
|
-
|
|
41
41
|
try {
|
|
42
|
-
data =
|
|
42
|
+
data = JSONbig.parse(data)
|
|
43
|
+
if (typeof data.id !== 'string') {
|
|
44
|
+
data.id = data.id.toString()
|
|
45
|
+
}
|
|
43
46
|
} catch (e) {
|
|
44
47
|
logger.debug(e, 'Failed to parse GCP metadata.')
|
|
45
48
|
data = null
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "newrelic",
|
|
3
|
-
"version": "9.8.
|
|
3
|
+
"version": "9.8.1",
|
|
4
4
|
"author": "New Relic Node.js agent team <nodejs@newrelic.com>",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"contributors": [
|
|
@@ -187,6 +187,7 @@
|
|
|
187
187
|
"@tyriar/fibonacci-heap": "^2.0.7",
|
|
188
188
|
"concat-stream": "^2.0.0",
|
|
189
189
|
"https-proxy-agent": "^5.0.0",
|
|
190
|
+
"json-bigint": "^1.0.0",
|
|
190
191
|
"json-stringify-safe": "^5.0.0",
|
|
191
192
|
"readable-stream": "^3.6.0",
|
|
192
193
|
"semver": "^5.3.0",
|