newrelic 13.1.0 → 13.2.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 +46 -0
- package/README.md +2 -4
- package/THIRD_PARTY_NOTICES.md +3 -3
- package/esm-loader.mjs +9 -1
- package/index.js +2 -2
- package/lib/agent.js +1 -2
- package/lib/config/build-instrumentation-config.js +3 -0
- package/lib/config/default.js +1397 -1395
- package/lib/config/index.js +15 -19
- package/lib/context-manager/context.js +13 -4
- package/lib/harvester.js +11 -13
- package/lib/instrumentation/@google/genai.js +8 -3
- package/lib/instrumentation/@hapi/hapi.js +4 -6
- package/lib/instrumentation/@nestjs/core.js +12 -14
- package/lib/instrumentation/aws-sdk/v3/bedrock.js +2 -2
- package/lib/instrumentation/kafkajs/producer.js +13 -19
- package/lib/instrumentation/openai.js +2 -2
- package/lib/instrumentation/undici.js +48 -40
- package/lib/instrumentations.js +14 -5
- package/lib/llm-events/aws-bedrock/utils.js +1 -1
- package/lib/metrics/names.js +8 -0
- package/lib/metrics/normalizer.js +1 -3
- package/lib/otel/context.js +18 -14
- package/lib/otel/metrics/bootstrap-metrics.js +1 -1
- package/lib/patch-module.js +70 -0
- package/lib/serverless/aws-lambda.js +1 -3
- package/lib/shim/webframework-shim/middleware-mounter.js +1 -3
- package/lib/shimmer.js +56 -8
- package/lib/subscriber-configs.js +17 -0
- package/lib/subscribers/application-logs.js +55 -0
- package/lib/subscribers/base.js +177 -0
- package/lib/subscribers/create-config.js +27 -0
- package/lib/subscribers/db-operation.js +21 -0
- package/lib/subscribers/db-query.js +54 -0
- package/lib/subscribers/db.js +57 -0
- package/lib/subscribers/elasticsearch/config.js +49 -0
- package/lib/subscribers/elasticsearch/elasticsearch.js +42 -0
- package/lib/subscribers/elasticsearch/opensearch.js +15 -0
- package/lib/subscribers/elasticsearch/transport.js +14 -0
- package/lib/subscribers/ioredis/config.js +37 -0
- package/lib/subscribers/ioredis/index.js +48 -0
- package/lib/subscribers/mcp-sdk/client-prompt.js +23 -0
- package/lib/subscribers/mcp-sdk/client-resource.js +24 -0
- package/lib/subscribers/mcp-sdk/client-tool.js +23 -0
- package/lib/subscribers/mcp-sdk/client.js +29 -0
- package/lib/subscribers/mcp-sdk/config.js +104 -0
- package/lib/subscribers/pino/config.js +20 -0
- package/lib/subscribers/pino/index.js +102 -0
- package/lib/transaction/trace/aggregator.js +7 -9
- package/lib/util/camel-case.js +1 -3
- package/lib/util/get-package-version.js +34 -0
- package/lib/w3c/tracestate.js +3 -3
- package/package.json +7 -5
- package/lib/instrumentation/@elastic/elasticsearch.js +0 -62
- package/lib/instrumentation/@opensearch-project/opensearch.js +0 -66
- package/lib/instrumentation/ioredis.js +0 -50
- package/lib/instrumentation/pino/nr-hooks.js +0 -19
- package/lib/instrumentation/pino/pino.js +0 -168
package/NEWS.md
CHANGED
|
@@ -1,3 +1,47 @@
|
|
|
1
|
+
### v13.2.0 (2025-08-20)
|
|
2
|
+
|
|
3
|
+
#### Features
|
|
4
|
+
|
|
5
|
+
* Added ability to register `Supportability/Features/Instrumentation/OnRequire/<pkg>` metrics for subscriber based instrumentation ([#3312](https://github.com/newrelic/node-newrelic/pull/3312)) ([87bfa40](https://github.com/newrelic/node-newrelic/commit/87bfa400c216352f12bbbc500e74f8e58285a275))
|
|
6
|
+
* Added esm loader hook and commonjs patch to work with orchestrion-js ([#3312](https://github.com/newrelic/node-newrelic/pull/3312)) ([415aeba](https://github.com/newrelic/node-newrelic/commit/415aeba6db04aa54cc1f44e64c0e6d2235d47108))
|
|
7
|
+
* Added instrumentation for `@modelcontextprotocol/sdk` client calls `client.callTool`, `client.readResource`, and `client.getPrompt` ([#3312](https://github.com/newrelic/node-newrelic/pull/3312)) ([5d9790b](https://github.com/newrelic/node-newrelic/commit/5d9790b4bd9ab24db4a38618ef96c3b50fbadae7))
|
|
8
|
+
|
|
9
|
+
#### Bug fixes
|
|
10
|
+
|
|
11
|
+
* Fixed logic around detecting OTEL packages ([#3326](https://github.com/newrelic/node-newrelic/pull/3326)) ([4df30e5](https://github.com/newrelic/node-newrelic/commit/4df30e5c2021e0d933e4a77ccd4409405928fa39))
|
|
12
|
+
* Updated `shimmer.setupSubscribers` to properly setup and skip subscribers that are disabled ([#3312](https://github.com/newrelic/node-newrelic/pull/3312)) ([cf5b3ec](https://github.com/newrelic/node-newrelic/commit/cf5b3ec39e2cad05c46ec7865f5b8b8377cb4710))
|
|
13
|
+
|
|
14
|
+
#### Code refactoring
|
|
15
|
+
|
|
16
|
+
* Added ability to disable subscribers via `config.instrumentation.<pkg-name>.enabled` ([#3312](https://github.com/newrelic/node-newrelic/pull/3312)) ([55f8fe7](https://github.com/newrelic/node-newrelic/commit/55f8fe7bc7035ab1822986eb51a228e266e3d3eb))
|
|
17
|
+
* Added ability to prevent creation of segments in subscriber based instrumentation when parent is marked as internal and of the same package ([#3322](https://github.com/newrelic/node-newrelic/pull/3322)) ([91f91c2](https://github.com/newrelic/node-newrelic/commit/91f91c2c85f2715bb1c1db5847704623fd65851e))
|
|
18
|
+
* Removed `id` parameter from `opensearch` class ([#3312](https://github.com/newrelic/node-newrelic/pull/3312)) ([8be00ce](https://github.com/newrelic/node-newrelic/commit/8be00cef67a2637f7d7a3ab33cccb6824ab34478))
|
|
19
|
+
* Updated `opensearch` instrumentation to subscribe to events emitted ([#3312](https://github.com/newrelic/node-newrelic/pull/3312)) ([9a27a5d](https://github.com/newrelic/node-newrelic/commit/9a27a5daba8a82c350cf129e3b2548527868ae90))
|
|
20
|
+
* Updated elasticsearch instrumentation to subscribe to events emitted ([#3312](https://github.com/newrelic/node-newrelic/pull/3312)) ([a3e2348](https://github.com/newrelic/node-newrelic/commit/a3e2348d9af62d12cb570c26f557096968d38daa))
|
|
21
|
+
* Updated ioredis instrumentation to subscribe to events emitted ([#3312](https://github.com/newrelic/node-newrelic/pull/3312)) ([90b97d2](https://github.com/newrelic/node-newrelic/commit/90b97d28a9bbf5c1646ce3ca399bb6772c17c07c))
|
|
22
|
+
* Updated pino instrumentation to subscribe to events emitted ([#3312](https://github.com/newrelic/node-newrelic/pull/3312)) ([28bbe9f](https://github.com/newrelic/node-newrelic/commit/28bbe9fee831d57d4fb77d01ef4cd2f6072bf9d8))
|
|
23
|
+
* Updated subscribers to have a common createSegment that creates, assigns attributes, starts segment ([#3317](https://github.com/newrelic/node-newrelic/pull/3317)) ([aa3f8d9](https://github.com/newrelic/node-newrelic/commit/aa3f8d936aa9fd7ffdad1f771dc16da8782ad917))
|
|
24
|
+
* Updated undici instrumentation to remove its reliance on shim. Also updated storing the relevant segments on context instead of symbols on the request object ([#3312](https://github.com/newrelic/node-newrelic/pull/3312)) ([ec17fa7](https://github.com/newrelic/node-newrelic/commit/ec17fa7ef431bf51c527d2c58cdf216fee641884))
|
|
25
|
+
|
|
26
|
+
#### Documentation
|
|
27
|
+
|
|
28
|
+
* Updated compatibility report ([#3313](https://github.com/newrelic/node-newrelic/pull/3313)) ([749ddc9](https://github.com/newrelic/node-newrelic/commit/749ddc9c050ee81f8969e8f173233dcb78826da1)) ([#3304](https://github.com/newrelic/node-newrelic/pull/3304)) ([cc000a7](https://github.com/newrelic/node-newrelic/commit/cc000a72870b508c929449b57a35d289ce093f42))
|
|
29
|
+
|
|
30
|
+
#### Miscellaneous chores
|
|
31
|
+
|
|
32
|
+
* change from ending segment to touching for feature parity with shim ([#3312](https://github.com/newrelic/node-newrelic/pull/3312)) ([4d39fc5](https://github.com/newrelic/node-newrelic/commit/4d39fc564a23798d42105398d0b8ea6c0e9280cc))
|
|
33
|
+
* Updated eslint configuration ([#3296](https://github.com/newrelic/node-newrelic/pull/3296)) ([5c168a6](https://github.com/newrelic/node-newrelic/commit/5c168a657cddece16c0b1124307526ffb3588953))
|
|
34
|
+
|
|
35
|
+
#### Tests
|
|
36
|
+
|
|
37
|
+
* Fixed obtaining opensearch package version for older versions we instrument ([#3314](https://github.com/newrelic/node-newrelic/pull/3314)) ([e45ab27](https://github.com/newrelic/node-newrelic/commit/e45ab275109dd601945776c0de88ba954a8c57e2))
|
|
38
|
+
* Removed unnecessary `prisma.$use` in tests to unpin ([#3303](https://github.com/newrelic/node-newrelic/pull/3303)) ([db20324](https://github.com/newrelic/node-newrelic/commit/db20324535ebf714237dc716c3f6718fd90cfb36))
|
|
39
|
+
|
|
40
|
+
#### Continuous integration
|
|
41
|
+
|
|
42
|
+
* Allow users to run benchmark tests even if not sending metrics ([#3307](https://github.com/newrelic/node-newrelic/pull/3307)) ([1be1514](https://github.com/newrelic/node-newrelic/commit/1be1514c9d49465a29e6b8fbc09c3bb5ebc1b112))
|
|
43
|
+
* Change benchmark tests to use `TEST_LICENSE` ([#3325](https://github.com/newrelic/node-newrelic/pull/3325)) ([1f7f733](https://github.com/newrelic/node-newrelic/commit/1f7f733b2d10a5447662e159038fa32f1c036235))
|
|
44
|
+
|
|
1
45
|
### v13.1.0 (2025-08-13)
|
|
2
46
|
|
|
3
47
|
#### Features
|
|
@@ -7767,3 +7811,5 @@ Special thanks to Ryan Copley (@RyanCopley) for the contribution.
|
|
|
7767
7811
|
* The agent reports transaction trace data.
|
|
7768
7812
|
|
|
7769
7813
|
[mdn-async-function]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function
|
|
7814
|
+
|
|
7815
|
+
|
package/README.md
CHANGED
|
@@ -105,14 +105,12 @@ The New Relic Node.js agent includes ***_experimental_*** support for ES Modules
|
|
|
105
105
|
$ mv newrelic.js newrelic.cjs
|
|
106
106
|
```
|
|
107
107
|
|
|
108
|
-
2. To use the newrelic ESM loader, start your program with node and use the `--
|
|
108
|
+
2. To use the newrelic ESM loader, start your program with node and use the `--import` flag and a path to the loader file, like this:
|
|
109
109
|
|
|
110
110
|
```sh
|
|
111
|
-
$ node --
|
|
111
|
+
$ node --import newrelic/esm-loader.mjs -r newrelic your-program.js
|
|
112
112
|
```
|
|
113
113
|
|
|
114
|
-
**Note**: Unlike the CommonJS methods listed above, there are no alternatives to running the agent without the `--experimental-loader` flag.
|
|
115
|
-
|
|
116
114
|
### Custom Instrumentation
|
|
117
115
|
|
|
118
116
|
The agent supports adding your own custom instrumentation to ES module applications. You can use the instrumentation API methods. The only other difference between CommonJS custom instrumentation and ESM is you must provide a property of `isEsm: true`.
|
package/THIRD_PARTY_NOTICES.md
CHANGED
|
@@ -3229,7 +3229,7 @@ SOFTWARE.
|
|
|
3229
3229
|
|
|
3230
3230
|
### @newrelic/eslint-config
|
|
3231
3231
|
|
|
3232
|
-
This product includes source derived from [@newrelic/eslint-config](https://github.com/newrelic/eslint-config-newrelic) ([v0.
|
|
3232
|
+
This product includes source derived from [@newrelic/eslint-config](https://github.com/newrelic/eslint-config-newrelic) ([v0.6.0](https://github.com/newrelic/eslint-config-newrelic/tree/v0.6.0)), distributed under the [Apache-2.0 License](https://github.com/newrelic/eslint-config-newrelic/blob/v0.6.0/LICENSE):
|
|
3233
3233
|
|
|
3234
3234
|
```
|
|
3235
3235
|
Apache License
|
|
@@ -3646,7 +3646,7 @@ This product includes source derived from [@newrelic/newrelic-oss-cli](https://g
|
|
|
3646
3646
|
|
|
3647
3647
|
### @newrelic/test-utilities
|
|
3648
3648
|
|
|
3649
|
-
This product includes source derived from [@newrelic/test-utilities](https://github.com/newrelic/node-test-utilities) ([
|
|
3649
|
+
This product includes source derived from [@newrelic/test-utilities](https://github.com/newrelic/node-test-utilities) ([v10.0.0](https://github.com/newrelic/node-test-utilities/tree/v10.0.0)), distributed under the [Apache-2.0 License](https://github.com/newrelic/node-test-utilities/blob/v10.0.0/LICENSE):
|
|
3650
3650
|
|
|
3651
3651
|
```
|
|
3652
3652
|
Apache License
|
|
@@ -5683,7 +5683,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
5683
5683
|
|
|
5684
5684
|
### @newrelic/native-metrics
|
|
5685
5685
|
|
|
5686
|
-
This product includes source derived from [@newrelic/native-metrics](https://github.com/newrelic/node-native-metrics) ([
|
|
5686
|
+
This product includes source derived from [@newrelic/native-metrics](https://github.com/newrelic/node-native-metrics) ([v12.0.0](https://github.com/newrelic/node-native-metrics/tree/v12.0.0)), distributed under the [Apache-2.0 License](https://github.com/newrelic/node-native-metrics/blob/v12.0.0/LICENSE):
|
|
5687
5687
|
|
|
5688
5688
|
```
|
|
5689
5689
|
Apache License
|
package/esm-loader.mjs
CHANGED
|
@@ -3,4 +3,12 @@
|
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// eslint-disable-next-line n/no-unsupported-features/node-builtins
|
|
7
|
+
import { register } from 'node:module'
|
|
8
|
+
// Exclusions must be regexes
|
|
9
|
+
const exclusions = [/@openai\/agents.*/]
|
|
10
|
+
|
|
11
|
+
register('./esm-rewriter.mjs', import.meta.url)
|
|
12
|
+
register('import-in-the-middle/hook.mjs', import.meta.url, {
|
|
13
|
+
data: { exclude: exclusions }
|
|
14
|
+
})
|
package/index.js
CHANGED
|
@@ -28,7 +28,7 @@ logger.info(
|
|
|
28
28
|
)
|
|
29
29
|
const path = require('node:path')
|
|
30
30
|
const Module = require('node:module')
|
|
31
|
-
const otelPackages = Object.keys(pkgJSON.dependencies).filter(d => d.startsWith('@opentelemetry'))
|
|
31
|
+
const otelPackages = Object.keys(pkgJSON.dependencies).filter((d) => d.startsWith('@opentelemetry'))
|
|
32
32
|
const otelRequire = Module.createRequire(path.join(__dirname, __filename))
|
|
33
33
|
|
|
34
34
|
if (require.cache.__NR_cache) {
|
|
@@ -293,7 +293,7 @@ function otelBridgeAvailable() {
|
|
|
293
293
|
try {
|
|
294
294
|
otelRequire.resolve(p)
|
|
295
295
|
} catch (error) {
|
|
296
|
-
if (error.code
|
|
296
|
+
if (error.code.includes('MODULE_NOT_FOUND')) {
|
|
297
297
|
return false
|
|
298
298
|
}
|
|
299
299
|
}
|
package/lib/agent.js
CHANGED
|
@@ -267,8 +267,7 @@ function Agent(config) {
|
|
|
267
267
|
periodMs: config.event_harvest_config.report_period_ms,
|
|
268
268
|
limit: config.event_harvest_config.harvest_limits.log_event_data,
|
|
269
269
|
config,
|
|
270
|
-
enabled: (config) =>
|
|
271
|
-
config.application_logging.enabled && config.application_logging.forwarding.enabled
|
|
270
|
+
enabled: (config) => config.application_logging.enabled && config.application_logging.forwarding.enabled
|
|
272
271
|
},
|
|
273
272
|
this
|
|
274
273
|
)
|
|
@@ -9,6 +9,9 @@ const instrumentedLibraries = require('../instrumentations')()
|
|
|
9
9
|
const pkgNames = Object.keys(instrumentedLibraries)
|
|
10
10
|
const coreLibraries = require('../core-instrumentation')
|
|
11
11
|
const corePkgs = Object.keys(coreLibraries)
|
|
12
|
+
const subscriptions = require('../subscriber-configs')
|
|
13
|
+
const subscribers = Object.keys(subscriptions)
|
|
14
|
+
pkgNames.push(...subscribers)
|
|
12
15
|
// Manually adding undici as it is registered separately in shimmer
|
|
13
16
|
corePkgs.push('undici')
|
|
14
17
|
// Manually adding domain as it is registered separately in shimmer
|