newrelic 11.20.0 → 11.22.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 +45 -0
- package/THIRD_PARTY_NOTICES.md +7 -7
- package/index.js +2 -2
- package/lib/llm-events/aws-bedrock/bedrock-command.js +5 -5
- package/lib/llm-events/aws-bedrock/bedrock-response.js +2 -2
- package/lib/llm-events/aws-bedrock/stream-handler.js +3 -3
- package/lib/serverless/api-gateway.js +1 -1
- package/lib/utilization/docker-info.js +124 -21
- package/package.json +7 -2
package/NEWS.md
CHANGED
|
@@ -1,3 +1,48 @@
|
|
|
1
|
+
### v11.22.0 (2024-06-28)
|
|
2
|
+
|
|
3
|
+
#### Features
|
|
4
|
+
|
|
5
|
+
* Added support for Node 22([#2305](https://github.com/newrelic/node-newrelic/pull/2305)) ([0bf8908](https://github.com/newrelic/node-newrelic/commit/0bf89081a59fe598b22613257f519c171149c454))
|
|
6
|
+
* Added AIM support for Meta Llama3 models in AWS Bedrock ([#2306](https://github.com/newrelic/node-newrelic/pull/2306)) ([ff2e509](https://github.com/newrelic/node-newrelic/commit/ff2e509913c2169c274387db461edffeee896834))
|
|
7
|
+
|
|
8
|
+
#### Documentation
|
|
9
|
+
|
|
10
|
+
* Updated compatibility report ([#2309](https://github.com/newrelic/node-newrelic/pull/2309)) ([7bf77c6](https://github.com/newrelic/node-newrelic/commit/7bf77c6b41d8313c6837293f42901c6e13954af4))
|
|
11
|
+
|
|
12
|
+
#### Miscellaneous chores
|
|
13
|
+
|
|
14
|
+
* Added [@amychisholm03](https://github.com/amychisholm03) to list of contributors 🎉 ([#2310](https://github.com/newrelic/node-newrelic/pull/2310)) ([8a890f1](https://github.com/newrelic/node-newrelic/commit/8a890f1d8879715be3b15bdc58f95c764c112646))
|
|
15
|
+
* Forced re-creation of API docs on gh-pages ([#2307](https://github.com/newrelic/node-newrelic/pull/2307)) ([917110a](https://github.com/newrelic/node-newrelic/commit/917110a189bc77823f114b1bfb338788fa2b6043))
|
|
16
|
+
|
|
17
|
+
#### Tests
|
|
18
|
+
|
|
19
|
+
* Updated undici versioned tests to assert an error is present and not the actual message ([#2299](https://github.com/newrelic/node-newrelic/pull/2299)) ([4e38ed4](https://github.com/newrelic/node-newrelic/commit/4e38ed494f2706d4c6b3f89474efb7365e766903))
|
|
20
|
+
|
|
21
|
+
#### Continuous integration
|
|
22
|
+
|
|
23
|
+
* Added Node 22 to CI ([#2164](https://github.com/newrelic/node-newrelic/pull/2164)) ([4b12d9e](https://github.com/newrelic/node-newrelic/commit/4b12d9e7d89d8367fdb895b24e2818ff85d67592))
|
|
24
|
+
* Added Node 22 to smoke tests and nightly versioned test runs ([#2316](https://github.com/newrelic/node-newrelic/pull/2316)) ([af00666](https://github.com/newrelic/node-newrelic/commit/af00666d3b1a3458c40bd6f0e3dca6ac2e477335))
|
|
25
|
+
* Moved the docs PR job to before api docs publish ([#2300](https://github.com/newrelic/node-newrelic/pull/2300)) ([2e7252e](https://github.com/newrelic/node-newrelic/commit/2e7252ef3281046c3c85722ccede582e5aefa1a9))
|
|
26
|
+
|
|
27
|
+
### v11.21.0 (2024-06-25)
|
|
28
|
+
|
|
29
|
+
#### Features
|
|
30
|
+
|
|
31
|
+
* Added support for getting container ids from ECS metadata API ([#2292](https://github.com/newrelic/node-newrelic/pull/2292)) ([dbca830](https://github.com/newrelic/node-newrelic/commit/dbca830deb6c9420427b60df4875ba71939508c4))
|
|
32
|
+
|
|
33
|
+
#### Bug fixes
|
|
34
|
+
|
|
35
|
+
* Handled assigning headers in LambdaProxyWebRequest when there are no headers present ([#2293](https://github.com/newrelic/node-newrelic/pull/2293)) ([e4d22f3](https://github.com/newrelic/node-newrelic/commit/e4d22f38b70cee061b345d6dbc94a2783a164b76))
|
|
36
|
+
|
|
37
|
+
#### Documentation
|
|
38
|
+
|
|
39
|
+
* Updated compatibility report ([#2290](https://github.com/newrelic/node-newrelic/pull/2290)) ([b5fc893](https://github.com/newrelic/node-newrelic/commit/b5fc8932ed5a0372f8be3f0e53c6d9fa0cf12855))
|
|
40
|
+
|
|
41
|
+
#### Tests
|
|
42
|
+
|
|
43
|
+
* Fixed log error stack message truncating and failing equality test ([#2294](https://github.com/newrelic/node-newrelic/pull/2294)) ([8e06f0f](https://github.com/newrelic/node-newrelic/commit/8e06f0f77762922e7862446bdf85a32eef3f9096))
|
|
44
|
+
* Updated shimmer method in benchmark tests ([#2281](https://github.com/newrelic/node-newrelic/pull/2281)) ([1528d68](https://github.com/newrelic/node-newrelic/commit/1528d685c7fd8e9af23ea91bd66124b82dcdb523))
|
|
45
|
+
|
|
1
46
|
### v11.20.0 (2024-06-24)
|
|
2
47
|
|
|
3
48
|
#### Features
|
package/THIRD_PARTY_NOTICES.md
CHANGED
|
@@ -674,7 +674,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
674
674
|
|
|
675
675
|
### import-in-the-middle
|
|
676
676
|
|
|
677
|
-
This product includes source derived from [import-in-the-middle](https://github.com/DataDog/import-in-the-middle) ([v1.
|
|
677
|
+
This product includes source derived from [import-in-the-middle](https://github.com/DataDog/import-in-the-middle) ([v1.8.0](https://github.com/DataDog/import-in-the-middle/tree/v1.8.0)), distributed under the [Apache-2.0 License](https://github.com/DataDog/import-in-the-middle/blob/v1.8.0/LICENSE):
|
|
678
678
|
|
|
679
679
|
```
|
|
680
680
|
Copyright 2021 Datadog, Inc.
|
|
@@ -886,7 +886,7 @@ SOFTWARE.
|
|
|
886
886
|
|
|
887
887
|
### @aws-sdk/client-s3
|
|
888
888
|
|
|
889
|
-
This product includes source derived from [@aws-sdk/client-s3](https://github.com/aws/aws-sdk-js-v3) ([v3.
|
|
889
|
+
This product includes source derived from [@aws-sdk/client-s3](https://github.com/aws/aws-sdk-js-v3) ([v3.592.0](https://github.com/aws/aws-sdk-js-v3/tree/v3.592.0)), distributed under the [Apache-2.0 License](https://github.com/aws/aws-sdk-js-v3/blob/v3.592.0/LICENSE):
|
|
890
890
|
|
|
891
891
|
```
|
|
892
892
|
Apache License
|
|
@@ -1095,7 +1095,7 @@ This product includes source derived from [@aws-sdk/client-s3](https://github.co
|
|
|
1095
1095
|
|
|
1096
1096
|
### @aws-sdk/s3-request-presigner
|
|
1097
1097
|
|
|
1098
|
-
This product includes source derived from [@aws-sdk/s3-request-presigner](https://github.com/aws/aws-sdk-js-v3) ([v3.
|
|
1098
|
+
This product includes source derived from [@aws-sdk/s3-request-presigner](https://github.com/aws/aws-sdk-js-v3) ([v3.592.0](https://github.com/aws/aws-sdk-js-v3/tree/v3.592.0)), distributed under the [Apache-2.0 License](https://github.com/aws/aws-sdk-js-v3/blob/v3.592.0/LICENSE):
|
|
1099
1099
|
|
|
1100
1100
|
```
|
|
1101
1101
|
Apache License
|
|
@@ -1750,7 +1750,7 @@ This product includes source derived from [@newrelic/newrelic-oss-cli](https://g
|
|
|
1750
1750
|
|
|
1751
1751
|
### @newrelic/test-utilities
|
|
1752
1752
|
|
|
1753
|
-
This product includes source derived from [@newrelic/test-utilities](https://github.com/newrelic/node-test-utilities) ([v8.
|
|
1753
|
+
This product includes source derived from [@newrelic/test-utilities](https://github.com/newrelic/node-test-utilities) ([v8.6.0](https://github.com/newrelic/node-test-utilities/tree/v8.6.0)), distributed under the [Apache-2.0 License](https://github.com/newrelic/node-test-utilities/blob/v8.6.0/LICENSE):
|
|
1754
1754
|
|
|
1755
1755
|
```
|
|
1756
1756
|
Apache License
|
|
@@ -2493,7 +2493,7 @@ THE SOFTWARE.
|
|
|
2493
2493
|
|
|
2494
2494
|
### aws-sdk
|
|
2495
2495
|
|
|
2496
|
-
This product includes source derived from [aws-sdk](https://github.com/aws/aws-sdk-js) ([v2.
|
|
2496
|
+
This product includes source derived from [aws-sdk](https://github.com/aws/aws-sdk-js) ([v2.1636.0](https://github.com/aws/aws-sdk-js/tree/v2.1636.0)), distributed under the [Apache-2.0 License](https://github.com/aws/aws-sdk-js/blob/v2.1636.0/LICENSE.txt):
|
|
2497
2497
|
|
|
2498
2498
|
```
|
|
2499
2499
|
|
|
@@ -2892,7 +2892,7 @@ THE SOFTWARE.
|
|
|
2892
2892
|
|
|
2893
2893
|
### eslint-plugin-jsdoc
|
|
2894
2894
|
|
|
2895
|
-
This product includes source derived from [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) ([v48.2.
|
|
2895
|
+
This product includes source derived from [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) ([v48.2.8](https://github.com/gajus/eslint-plugin-jsdoc/tree/v48.2.8)), distributed under the [BSD-3-Clause License](https://github.com/gajus/eslint-plugin-jsdoc/blob/v48.2.8/LICENSE):
|
|
2896
2896
|
|
|
2897
2897
|
```
|
|
2898
2898
|
Copyright (c) 2018, Gajus Kuizinas (http://gajus.com/)
|
|
@@ -3941,7 +3941,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
3941
3941
|
|
|
3942
3942
|
### @contrast/fn-inspect
|
|
3943
3943
|
|
|
3944
|
-
This product includes source derived from [@contrast/fn-inspect](https://github.com/Contrast-Security-Inc/node-fn-inspect) ([
|
|
3944
|
+
This product includes source derived from [@contrast/fn-inspect](https://github.com/Contrast-Security-Inc/node-fn-inspect) ([v4.2.0](https://github.com/Contrast-Security-Inc/node-fn-inspect/tree/v4.2.0)), distributed under the [MIT License](https://github.com/Contrast-Security-Inc/node-fn-inspect/blob/v4.2.0/LICENSE):
|
|
3945
3945
|
|
|
3946
3946
|
```
|
|
3947
3947
|
Copyright 2022 Contrast Security, Inc
|
package/index.js
CHANGED
|
@@ -63,8 +63,8 @@ function initialize() {
|
|
|
63
63
|
throw new Error(message)
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
// TODO: Update this check when Node
|
|
67
|
-
if (psemver.satisfies('>=
|
|
66
|
+
// TODO: Update this check when Node v24 support is added
|
|
67
|
+
if (psemver.satisfies('>=23.0.0')) {
|
|
68
68
|
logger.warn(
|
|
69
69
|
'New Relic for Node.js %s has not been tested on Node.js %s. Please ' +
|
|
70
70
|
'update the agent or downgrade your version of Node.js',
|
|
@@ -37,7 +37,7 @@ class BedrockCommand {
|
|
|
37
37
|
result = this.#body.max_tokens_to_sample
|
|
38
38
|
} else if (this.isClaude3() === true || this.isCohere() === true) {
|
|
39
39
|
result = this.#body.max_tokens
|
|
40
|
-
} else if (this.
|
|
40
|
+
} else if (this.isLlama() === true) {
|
|
41
41
|
result = this.#body.max_gen_length
|
|
42
42
|
} else if (this.isTitan() === true) {
|
|
43
43
|
result = this.#body.textGenerationConfig?.maxTokenCount
|
|
@@ -80,7 +80,7 @@ class BedrockCommand {
|
|
|
80
80
|
this.isClaude() === true ||
|
|
81
81
|
this.isAi21() === true ||
|
|
82
82
|
this.isCohere() === true ||
|
|
83
|
-
this.
|
|
83
|
+
this.isLlama() === true
|
|
84
84
|
) {
|
|
85
85
|
result = this.#body.prompt
|
|
86
86
|
} else if (this.isClaude3() === true) {
|
|
@@ -104,7 +104,7 @@ class BedrockCommand {
|
|
|
104
104
|
this.isClaude3() === true ||
|
|
105
105
|
this.isAi21() === true ||
|
|
106
106
|
this.isCohere() === true ||
|
|
107
|
-
this.
|
|
107
|
+
this.isLlama() === true
|
|
108
108
|
) {
|
|
109
109
|
result = this.#body.temperature
|
|
110
110
|
}
|
|
@@ -131,8 +131,8 @@ class BedrockCommand {
|
|
|
131
131
|
return this.#modelId.startsWith('cohere.embed')
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
-
|
|
135
|
-
return this.#modelId.startsWith('meta.
|
|
134
|
+
isLlama() {
|
|
135
|
+
return this.#modelId.startsWith('meta.llama')
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
isTitan() {
|
|
@@ -70,7 +70,7 @@ class BedrockResponse {
|
|
|
70
70
|
} else if (cmd.isCohere() === true) {
|
|
71
71
|
this.#completions = body.generations?.map((g) => g.text) ?? []
|
|
72
72
|
this.#id = body.id
|
|
73
|
-
} else if (cmd.
|
|
73
|
+
} else if (cmd.isLlama() === true) {
|
|
74
74
|
body.generation && this.#completions.push(body.generation)
|
|
75
75
|
} else if (cmd.isTitan() === true) {
|
|
76
76
|
this.#completions = body.results?.map((r) => r.outputText) ?? []
|
|
@@ -107,7 +107,7 @@ class BedrockResponse {
|
|
|
107
107
|
result = this.#parsedBody.stop_reason
|
|
108
108
|
} else if (cmd.isCohere() === true) {
|
|
109
109
|
result = this.#parsedBody.generations?.find((r) => r.finish_reason !== null)?.finish_reason
|
|
110
|
-
} else if (cmd.
|
|
110
|
+
} else if (cmd.isLlama() === true) {
|
|
111
111
|
result = this.#parsedBody.stop_reason
|
|
112
112
|
} else if (cmd.isTitan() === true) {
|
|
113
113
|
result = this.#parsedBody.results?.find((r) => r.completionReason !== null)?.completionReason
|
|
@@ -114,9 +114,9 @@ class StreamHandler {
|
|
|
114
114
|
} else if (bedrockCommand.isCohereEmbed() === true) {
|
|
115
115
|
this.stopReasonKey = 'nr_none'
|
|
116
116
|
this.generator = handleCohereEmbed
|
|
117
|
-
} else if (bedrockCommand.
|
|
117
|
+
} else if (bedrockCommand.isLlama() === true) {
|
|
118
118
|
this.stopReasonKey = 'stop_reason'
|
|
119
|
-
this.generator =
|
|
119
|
+
this.generator = handleLlama
|
|
120
120
|
} else if (bedrockCommand.isTitan() === true) {
|
|
121
121
|
this.stopReasonKey = 'completionReason'
|
|
122
122
|
this.generator = handleTitan
|
|
@@ -271,7 +271,7 @@ async function* handleCohereEmbed() {
|
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
273
|
|
|
274
|
-
async function*
|
|
274
|
+
async function* handleLlama() {
|
|
275
275
|
let currentBody = {}
|
|
276
276
|
let generation = ''
|
|
277
277
|
|
|
@@ -5,52 +5,152 @@
|
|
|
5
5
|
|
|
6
6
|
'use strict'
|
|
7
7
|
|
|
8
|
-
const
|
|
8
|
+
const fs = require('node:fs')
|
|
9
|
+
const http = require('node:http')
|
|
10
|
+
const log = require('../logger').child({ component: 'docker-info' })
|
|
9
11
|
const common = require('./common')
|
|
10
12
|
const NAMES = require('../metrics/names')
|
|
11
13
|
const os = require('os')
|
|
12
14
|
let vendorInfo = null
|
|
15
|
+
|
|
13
16
|
const CGROUPS_V1_PATH = '/proc/self/cgroup'
|
|
14
17
|
const CGROUPS_V2_PATH = '/proc/self/mountinfo'
|
|
18
|
+
const BOOT_ID_PROC_FILE = '/proc/sys/kernel/random/boot_id'
|
|
15
19
|
|
|
16
20
|
module.exports.getVendorInfo = fetchDockerVendorInfo
|
|
17
21
|
module.exports.clearVendorCache = function clearDockerVendorCache() {
|
|
18
22
|
vendorInfo = null
|
|
19
23
|
}
|
|
20
24
|
|
|
21
|
-
module.exports.getBootId = function getBootId(agent, callback) {
|
|
25
|
+
module.exports.getBootId = function getBootId(agent, callback, logger = log) {
|
|
22
26
|
if (!/linux/i.test(os.platform())) {
|
|
23
27
|
logger.debug('Platform is not a flavor of linux, omitting boot info')
|
|
24
28
|
return setImmediate(callback, null, null)
|
|
25
29
|
}
|
|
26
30
|
|
|
27
|
-
|
|
28
|
-
if (
|
|
29
|
-
|
|
30
|
-
return
|
|
31
|
+
fs.access(BOOT_ID_PROC_FILE, fs.constants.F_OK, (err) => {
|
|
32
|
+
if (err == null) {
|
|
33
|
+
// The boot id proc file exists, so use it to get the container id.
|
|
34
|
+
return common.readProc(BOOT_ID_PROC_FILE, (_, data, cbAgent = agent) => {
|
|
35
|
+
readProcBootId({ data, agent: cbAgent, callback })
|
|
36
|
+
})
|
|
31
37
|
}
|
|
32
38
|
|
|
33
|
-
|
|
34
|
-
const asciiData = Buffer.from(data, 'ascii').toString()
|
|
39
|
+
logger.debug('Container boot id is not available in cgroups info')
|
|
35
40
|
|
|
36
|
-
if (
|
|
37
|
-
|
|
41
|
+
if (hasAwsContainerApi() === false) {
|
|
42
|
+
// We don't seem to have a recognized location for getting the container
|
|
43
|
+
// identifier.
|
|
44
|
+
logger.debug('Container is not in a recognized ECS container, omitting boot info')
|
|
45
|
+
recordBootIdError(agent)
|
|
38
46
|
return callback(null, null)
|
|
39
47
|
}
|
|
40
48
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
49
|
+
getEcsContainerId({ agent, callback, logger })
|
|
50
|
+
})
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Queries the AWS ECS metadata API to get the boot id.
|
|
55
|
+
*
|
|
56
|
+
* @param {object} params Function parameters.
|
|
57
|
+
* @param {object} params.agent Newrelic agent instance.
|
|
58
|
+
* @param {Function} params.callback Typical error first callback. The second
|
|
59
|
+
* parameter is the boot id as a string.
|
|
60
|
+
* @param {object} [params.logger] Internal logger instance.
|
|
61
|
+
*/
|
|
62
|
+
function getEcsContainerId({ agent, callback, logger }) {
|
|
63
|
+
const ecsApiUrl =
|
|
64
|
+
process.env.ECS_CONTAINER_METADATA_URI_V4 || process.env.ECS_CONTAINER_METADATA_URI
|
|
65
|
+
const req = http.request(ecsApiUrl, (res) => {
|
|
66
|
+
let body = Buffer.alloc(0)
|
|
67
|
+
res.on('data', (chunk) => {
|
|
68
|
+
body = Buffer.concat([body, chunk])
|
|
69
|
+
})
|
|
70
|
+
res.on('end', () => {
|
|
71
|
+
try {
|
|
72
|
+
const json = body.toString('utf8')
|
|
73
|
+
const data = JSON.parse(json)
|
|
74
|
+
if (data.DockerId == null) {
|
|
75
|
+
logger.debug('Failed to find DockerId in response, omitting boot info')
|
|
76
|
+
recordBootIdError(agent)
|
|
77
|
+
return callback(null, null)
|
|
78
|
+
}
|
|
79
|
+
callback(null, data.DockerId)
|
|
80
|
+
} catch (error) {
|
|
81
|
+
logger.debug('Failed to process ECS API response, omitting boot info: ' + error.message)
|
|
82
|
+
recordBootIdError(agent)
|
|
83
|
+
callback(null, null)
|
|
45
84
|
}
|
|
46
|
-
}
|
|
85
|
+
})
|
|
86
|
+
})
|
|
47
87
|
|
|
48
|
-
|
|
88
|
+
req.on('error', () => {
|
|
89
|
+
logger.debug('Failed to query ECS endpoint, omitting boot info')
|
|
90
|
+
recordBootIdError(agent)
|
|
91
|
+
callback(null, null)
|
|
49
92
|
})
|
|
50
93
|
|
|
51
|
-
|
|
52
|
-
|
|
94
|
+
req.end()
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Inspects the running environment to determine if the AWS ECS metadata API
|
|
99
|
+
* is available.
|
|
100
|
+
*
|
|
101
|
+
* @see https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ec2-metadata.html
|
|
102
|
+
*
|
|
103
|
+
* @returns {boolean}
|
|
104
|
+
*/
|
|
105
|
+
function hasAwsContainerApi() {
|
|
106
|
+
if (process.env.ECS_CONTAINER_METADATA_URI_V4 != null) {
|
|
107
|
+
return true
|
|
53
108
|
}
|
|
109
|
+
return process.env.ECS_CONTAINER_METADATA_URI != null
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Increments a supportability metric to indicate that there was an error
|
|
114
|
+
* while trying to read the boot id from the system.
|
|
115
|
+
*
|
|
116
|
+
* @param {object} agent Newrelic agent instance.
|
|
117
|
+
*/
|
|
118
|
+
function recordBootIdError(agent) {
|
|
119
|
+
agent.metrics.getOrCreateMetric(NAMES.UTILIZATION.BOOT_ID_ERROR).incrementCallCount()
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Utility function to parse a Docker boot id from a cgroup proc file.
|
|
124
|
+
*
|
|
125
|
+
* @param {Buffer} data The information from the proc file.
|
|
126
|
+
* @param {object} agent Newrelic agent instance.
|
|
127
|
+
* @param {Function} callback Typical error first callback. Second parameter
|
|
128
|
+
* is the boot id as a string.
|
|
129
|
+
*
|
|
130
|
+
* @returns {*}
|
|
131
|
+
*/
|
|
132
|
+
function readProcBootId({ data, agent, callback }) {
|
|
133
|
+
if (!data) {
|
|
134
|
+
recordBootIdError(agent)
|
|
135
|
+
return callback(null, null)
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
data = data.trim()
|
|
139
|
+
const asciiData = Buffer.from(data, 'ascii').toString()
|
|
140
|
+
|
|
141
|
+
if (data !== asciiData) {
|
|
142
|
+
recordBootIdError(agent)
|
|
143
|
+
return callback(null, null)
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
if (data.length !== 36) {
|
|
147
|
+
recordBootIdError(agent)
|
|
148
|
+
if (data.length > 128) {
|
|
149
|
+
data = data.substring(0, 128)
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return callback(null, data)
|
|
54
154
|
}
|
|
55
155
|
|
|
56
156
|
/**
|
|
@@ -58,8 +158,9 @@ module.exports.getBootId = function getBootId(agent, callback) {
|
|
|
58
158
|
*
|
|
59
159
|
* @param {object} agent NR instance
|
|
60
160
|
* @param {Function} callback function to call when done
|
|
161
|
+
* @param {object} [logger] internal logger instance
|
|
61
162
|
*/
|
|
62
|
-
function fetchDockerVendorInfo(agent, callback) {
|
|
163
|
+
function fetchDockerVendorInfo(agent, callback, logger = log) {
|
|
63
164
|
if (!agent.config.utilization || !agent.config.utilization.detect_docker) {
|
|
64
165
|
return callback(null, null)
|
|
65
166
|
}
|
|
@@ -93,8 +194,9 @@ function fetchDockerVendorInfo(agent, callback) {
|
|
|
93
194
|
*
|
|
94
195
|
* @param {string} data file contents
|
|
95
196
|
* @param {Function} callback function to call when done
|
|
197
|
+
* @param {object} [logger] internal logger instance
|
|
96
198
|
*/
|
|
97
|
-
function parseCGroupsV2(data, callback) {
|
|
199
|
+
function parseCGroupsV2(data, callback, logger = log) {
|
|
98
200
|
const containerLine = new RegExp('/docker/containers/([0-9a-f]{64})/')
|
|
99
201
|
const line = containerLine.exec(data)
|
|
100
202
|
if (line) {
|
|
@@ -110,8 +212,9 @@ function parseCGroupsV2(data, callback) {
|
|
|
110
212
|
* e.g. - `4:cpu:/docker/f37a7e4d17017e7bf774656b19ca4360c6cdc4951c86700a464101d0d9ce97ee`
|
|
111
213
|
*
|
|
112
214
|
* @param {Function} callback function to call when done
|
|
215
|
+
* @param {object} [logger] internal logger instance
|
|
113
216
|
*/
|
|
114
|
-
function findCGroupsV1(callback) {
|
|
217
|
+
function findCGroupsV1(callback, logger = log) {
|
|
115
218
|
common.readProc(CGROUPS_V1_PATH, function getCGroup(err, data) {
|
|
116
219
|
if (!data) {
|
|
117
220
|
logger.debug(`${CGROUPS_V1_PATH} not found, exiting parsing containerId.`)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "newrelic",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.22.0",
|
|
4
4
|
"author": "New Relic Node.js agent team <nodejs@newrelic.com>",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"contributors": [
|
|
@@ -133,6 +133,11 @@
|
|
|
133
133
|
"name": "Svetlana Brennan",
|
|
134
134
|
"email": "sbrennan@newrelic.com",
|
|
135
135
|
"web": "https://newrelic.com"
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"name": "Amy Chisholm",
|
|
139
|
+
"email": "achisholm@newrelic.com",
|
|
140
|
+
"web": "https://newrelic.com"
|
|
136
141
|
}
|
|
137
142
|
],
|
|
138
143
|
"description": "New Relic agent",
|
|
@@ -208,7 +213,7 @@
|
|
|
208
213
|
"winston-transport": "^4.5.0"
|
|
209
214
|
},
|
|
210
215
|
"optionalDependencies": {
|
|
211
|
-
"@contrast/fn-inspect": "^
|
|
216
|
+
"@contrast/fn-inspect": "^4.2.0",
|
|
212
217
|
"@newrelic/native-metrics": "^10.0.0",
|
|
213
218
|
"@prisma/prisma-fmt-wasm": "^4.17.0-16.27eb2449f178cd9fe1a4b892d732cc4795f75085"
|
|
214
219
|
},
|