newrelic 13.3.3 → 13.5.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.
Files changed (169) hide show
  1. package/NEWS.md +54 -0
  2. package/THIRD_PARTY_NOTICES.md +11 -11
  3. package/api.js +1 -1
  4. package/esm-loader.mjs +2 -2
  5. package/lib/agent.js +2 -2
  6. package/lib/aggregators/event-aggregator.js +0 -2
  7. package/lib/attributes.js +6 -6
  8. package/lib/collector/api.js +1 -1
  9. package/lib/collector/facts.js +1 -1
  10. package/lib/collector/http-agents.js +2 -2
  11. package/lib/collector/parse-response.js +9 -12
  12. package/lib/collector/remote-method.js +4 -5
  13. package/lib/collector/serverless.js +1 -1
  14. package/lib/config/build-instrumentation-config.js +13 -3
  15. package/lib/config/default.js +21 -10
  16. package/lib/config/formatters.js +5 -6
  17. package/lib/config/index.js +37 -24
  18. package/lib/harvester.js +1 -1
  19. package/lib/header-processing.js +3 -3
  20. package/lib/health-reporter.js +2 -2
  21. package/lib/instrumentation/@node-redis/client.js +1 -1
  22. package/lib/instrumentation/@prisma/client.js +1 -1
  23. package/lib/instrumentation/aws-sdk/util.js +3 -3
  24. package/lib/instrumentation/aws-sdk/v2/instrumentation-helper.js +2 -2
  25. package/lib/instrumentation/aws-sdk/v3/bedrock.js +5 -5
  26. package/lib/instrumentation/aws-sdk/v3/common.js +14 -14
  27. package/lib/instrumentation/aws-sdk/v3/dynamodb.js +13 -13
  28. package/lib/instrumentation/aws-sdk/v3/lambda.js +3 -3
  29. package/lib/instrumentation/aws-sdk/v3/sns.js +12 -12
  30. package/lib/instrumentation/aws-sdk/v3/sqs.js +9 -9
  31. package/lib/instrumentation/core/http-outbound.js +1 -2
  32. package/lib/instrumentation/fastify/spec-builders.js +9 -29
  33. package/lib/instrumentation/fastify.js +23 -94
  34. package/lib/instrumentation/kafkajs/consumer.js +1 -1
  35. package/lib/instrumentation/koa/instrumentation.js +1 -1
  36. package/lib/instrumentation/langchain/runnable.js +1 -1
  37. package/lib/instrumentation/memcached.js +4 -4
  38. package/lib/instrumentation/mongodb.js +2 -2
  39. package/lib/instrumentation/nextjs/next-server.js +1 -3
  40. package/lib/instrumentation/nextjs/utils.js +2 -2
  41. package/lib/instrumentation/restify.js +2 -2
  42. package/lib/instrumentation/when/contextualizer.js +1 -1
  43. package/lib/instrumentation-descriptor.js +2 -11
  44. package/lib/instrumentations.js +1 -20
  45. package/lib/llm-events/aws-bedrock/bedrock-response.js +6 -6
  46. package/lib/llm-events/aws-bedrock/chat-completion-summary.js +2 -1
  47. package/lib/llm-events/aws-bedrock/converse-stream-handler.js +1 -1
  48. package/lib/llm-events/aws-bedrock/stream-handler.js +4 -4
  49. package/lib/metrics/index.js +2 -2
  50. package/lib/metrics/normalizer/rule.js +1 -1
  51. package/lib/metrics/normalizer.js +4 -5
  52. package/lib/metrics/recorders/database-operation.js +2 -3
  53. package/lib/metrics/recorders/message-transaction.js +3 -3
  54. package/lib/metrics/recorders/middleware.js +1 -2
  55. package/lib/otel/context-manager.js +4 -4
  56. package/lib/otel/trace-propagator.js +1 -1
  57. package/lib/otel/traces/segments/database.js +1 -1
  58. package/lib/otel/traces/utils.js +9 -9
  59. package/lib/prioritized-attributes.js +2 -2
  60. package/lib/{adaptive-sampler.js → samplers/adaptive-sampler.js} +8 -0
  61. package/lib/serverless/aws-lambda.js +4 -4
  62. package/lib/shim/datastore-shim.js +2 -2
  63. package/lib/shim/message-shim/consume.js +4 -4
  64. package/lib/shim/message-shim/subscribe-consume.js +1 -2
  65. package/lib/shim/promise-shim.js +1 -4
  66. package/lib/shim/shim.js +14 -29
  67. package/lib/shim/specs/class.js +3 -3
  68. package/lib/shim/specs/middleware-mounter.js +2 -2
  69. package/lib/shim/specs/middleware.js +3 -3
  70. package/lib/shim/specs/query.js +1 -1
  71. package/lib/shim/specs/recorder.js +1 -1
  72. package/lib/shim/specs/wrap.js +2 -2
  73. package/lib/shim/transaction-shim.js +0 -1
  74. package/lib/shim/webframework-shim/common.js +2 -4
  75. package/lib/shim/webframework-shim/index.js +10 -1
  76. package/lib/shim/webframework-shim/middleware.js +17 -21
  77. package/lib/shimmer.js +56 -103
  78. package/lib/spans/span-context.js +1 -1
  79. package/lib/spans/span-event-aggregator.js +2 -2
  80. package/lib/spans/span-event.js +6 -5
  81. package/lib/spans/streaming-span-attributes.js +1 -1
  82. package/lib/spans/streaming-span-event-aggregator.js +5 -3
  83. package/lib/spans/streaming-span-event.js +1 -1
  84. package/lib/stats/index.js +1 -1
  85. package/lib/subscriber-configs.js +6 -1
  86. package/lib/subscribers/amqplib/accept-message.js +14 -0
  87. package/lib/subscribers/amqplib/callback-model.js +39 -0
  88. package/lib/subscribers/amqplib/channel-model.js +39 -0
  89. package/lib/subscribers/amqplib/config.js +697 -0
  90. package/lib/subscribers/amqplib/connect.js +74 -0
  91. package/lib/subscribers/amqplib/consume.js +54 -0
  92. package/lib/subscribers/amqplib/get-cb.js +16 -0
  93. package/lib/subscribers/amqplib/get.js +50 -0
  94. package/lib/subscribers/amqplib/purge-queue-cb.js +16 -0
  95. package/lib/subscribers/amqplib/purge-queue.js +37 -0
  96. package/lib/subscribers/amqplib/send-message.js +44 -0
  97. package/lib/subscribers/amqplib/send-or-enqueue.js +18 -0
  98. package/lib/subscribers/amqplib/utils.js +53 -0
  99. package/lib/subscribers/application-logs.js +1 -1
  100. package/lib/subscribers/base.js +113 -29
  101. package/lib/subscribers/cassandra-driver/client-batch.js +49 -0
  102. package/lib/subscribers/cassandra-driver/client-connect.js +35 -0
  103. package/lib/subscribers/cassandra-driver/client-each-row.js +36 -0
  104. package/lib/subscribers/cassandra-driver/client-execute.js +36 -0
  105. package/lib/subscribers/cassandra-driver/client-shutdown.js +32 -0
  106. package/lib/subscribers/cassandra-driver/config.js +145 -0
  107. package/lib/subscribers/cassandra-driver/legacy-client-batch.js +22 -0
  108. package/lib/subscribers/cassandra-driver/legacy-client-connect.js +22 -0
  109. package/lib/subscribers/cassandra-driver/legacy-client-each-row.js +22 -0
  110. package/lib/subscribers/cassandra-driver/legacy-client-execute.js +21 -0
  111. package/lib/subscribers/cassandra-driver/legacy-client-shutdown.js +32 -0
  112. package/lib/subscribers/create-config.js +4 -6
  113. package/lib/subscribers/db-operation.js +12 -0
  114. package/lib/subscribers/db-query.js +5 -1
  115. package/lib/subscribers/dc-base.js +89 -0
  116. package/lib/subscribers/fastify/add-hook.js +46 -0
  117. package/lib/subscribers/fastify/common.js +121 -0
  118. package/lib/subscribers/fastify/config.js +39 -0
  119. package/lib/subscribers/fastify/decorate.js +35 -0
  120. package/lib/subscribers/fastify/index.js +31 -0
  121. package/lib/subscribers/mcp-sdk/client-request.js +1 -1
  122. package/lib/subscribers/mcp-sdk/config.js +2 -0
  123. package/lib/subscribers/message-consumer.js +146 -0
  124. package/lib/subscribers/message-producer.js +60 -0
  125. package/lib/subscribers/meta-subscriber.js +69 -0
  126. package/lib/subscribers/openai/base.js +27 -1
  127. package/lib/subscribers/openai/chat.js +0 -27
  128. package/lib/subscribers/openai/config.js +3 -3
  129. package/lib/subscribers/openai/utils.js +10 -11
  130. package/lib/subscribers/pg/config.js +91 -0
  131. package/lib/subscribers/pg/connect.js +28 -0
  132. package/lib/subscribers/pg/native-connect.js +25 -0
  133. package/lib/subscribers/pg/native-query.js +22 -0
  134. package/lib/subscribers/pg/query.js +66 -0
  135. package/lib/subscribers/pino/index.js +2 -2
  136. package/lib/subscribers/propagation.js +23 -0
  137. package/lib/subscribers/undici/config.js +11 -0
  138. package/lib/subscribers/undici/index.js +195 -0
  139. package/lib/synthetics.js +4 -4
  140. package/lib/timer.js +1 -1
  141. package/lib/tracking-packages.js +25 -0
  142. package/lib/transaction/dt-payload.js +1 -1
  143. package/lib/transaction/handle.js +8 -9
  144. package/lib/transaction/index.js +25 -21
  145. package/lib/transaction/name-state.js +11 -11
  146. package/lib/transaction/trace/segment.js +3 -4
  147. package/lib/transaction/tracer/index.js +1 -1
  148. package/lib/util/attribute-types.js +1 -1
  149. package/lib/util/byte-limit.js +1 -1
  150. package/lib/util/cat.js +13 -13
  151. package/lib/util/flatten.js +2 -3
  152. package/lib/util/is-absolute-path.js +1 -1
  153. package/lib/util/is-string.js +15 -0
  154. package/lib/util/llm-utils.js +3 -3
  155. package/lib/util/logger.js +8 -8
  156. package/lib/util/stream-sink.js +1 -1
  157. package/lib/utilization/docker-info.js +4 -3
  158. package/lib/utilization/ecs-info.js +1 -1
  159. package/lib/w3c/traceparent.js +3 -3
  160. package/lib/w3c/tracestate.js +1 -1
  161. package/package.json +2 -2
  162. package/lib/instrumentation/amqplib/amqplib.js +0 -122
  163. package/lib/instrumentation/amqplib/channel-model.js +0 -124
  164. package/lib/instrumentation/amqplib/channel.js +0 -72
  165. package/lib/instrumentation/amqplib/nr-hooks.js +0 -21
  166. package/lib/instrumentation/amqplib/utils.js +0 -143
  167. package/lib/instrumentation/cassandra-driver.js +0 -131
  168. package/lib/instrumentation/pg.js +0 -137
  169. package/lib/instrumentation/undici.js +0 -229
package/NEWS.md CHANGED
@@ -1,3 +1,55 @@
1
+ ### v13.5.0 (2025-10-14)
2
+
3
+ #### Code refactoring
4
+
5
+ * Updated `fastify` instrumentation to subscribe to events emitted ([#3407](https://github.com/newrelic/node-newrelic/pull/3407)) ([51e361e](https://github.com/newrelic/node-newrelic/commit/51e361ed736fa1235eeb16f1c5ec833a1b56a0bf))
6
+ * Updated `pg` and `pg-native` instrumentation to subscribe to events emitted ([#3397](https://github.com/newrelic/node-newrelic/pull/3397)) ([04af258](https://github.com/newrelic/node-newrelic/commit/04af2580a554ecabedab447d5edc5cec836d7f40))
7
+
8
+ * Updated `config.instrumentation.timers.enabled` to false to disable `timers.setTimeout` and `timers.setInterval` by default. ([#3414](https://github.com/newrelic/node-newrelic/pull/3414)) ([b925d3d](https://github.com/newrelic/node-newrelic/commit/b925d3d178886e6d4bbd0f2eaa6f51b6fddd7878))
9
+ * To re-enable, set `config.instrumentation.timers.enabled` to `true` in config or set `NEW_RELIC_INSTRUMENTATION_TIMERS_ENABLED=true`
10
+
11
+ #### Documentation
12
+
13
+ * Updated compatibility report ([#3413](https://github.com/newrelic/node-newrelic/pull/3413)) ([fef98dd](https://github.com/newrelic/node-newrelic/commit/fef98ddffddf60b32f162ea87dee2a3a0bdf8048))
14
+
15
+ #### Miscellaneous chores
16
+
17
+ * Added a new diagnostics base class and migrated undici to use new class ([#3408](https://github.com/newrelic/node-newrelic/pull/3408)) ([8047bf1](https://github.com/newrelic/node-newrelic/commit/8047bf165ae5105bb612c1a834d574078d52724d))
18
+ * Created directory for samplers ([#3419](https://github.com/newrelic/node-newrelic/pull/3419)) ([dd2d3df](https://github.com/newrelic/node-newrelic/commit/dd2d3dfe1bb2582de51e07a1cce6077df84f7108))
19
+
20
+ #### Styles
21
+
22
+ * Require `check-types` and `require-returns-type` jsdoc ([#3400](https://github.com/newrelic/node-newrelic/pull/3400)) ([e4cd687](https://github.com/newrelic/node-newrelic/commit/e4cd687c59aeaba6b627403bcb29b4b6576fe4d9))
23
+ * Require jsdoc `check*`, `implements-on-classes`, and some `no-undefined-types` ([#3404](https://github.com/newrelic/node-newrelic/pull/3404)) ([4fa645b](https://github.com/newrelic/node-newrelic/commit/4fa645b91900ff0acbd24b8f50c6fffcd07f3b82))
24
+ * Require jsdoc `require-returns-check` and `require-property-*` ([#3403](https://github.com/newrelic/node-newrelic/pull/3403)) ([1008073](https://github.com/newrelic/node-newrelic/commit/100807342b9c9283f43042024f15bb575de219ee))
25
+
26
+ #### Tests
27
+
28
+ * Added helper to get version of package when package.json not exported, and updated tests that need it ([#3411](https://github.com/newrelic/node-newrelic/pull/3411)) ([5ae02c7](https://github.com/newrelic/node-newrelic/commit/5ae02c7411cd7ae0a45203b025559c5442a7171e))
29
+ * Fixed fastify segment tree assertion when security agent is enabled ([#3422](https://github.com/newrelic/node-newrelic/pull/3422)) ([b2cf6ed](https://github.com/newrelic/node-newrelic/commit/b2cf6ed5d8debae23d0bb31e9a72b325464fadc2))
30
+ * Refactored mcp tests to listen on new port for every streaming test, removed unncessary shutdown of process ([#3420](https://github.com/newrelic/node-newrelic/pull/3420)) ([17db813](https://github.com/newrelic/node-newrelic/commit/17db8133e8e13c970362330885dccf4870942aea))
31
+ * Updated an openai assertion with setTimeout disabled ([#3421](https://github.com/newrelic/node-newrelic/pull/3421)) ([ceec8f9](https://github.com/newrelic/node-newrelic/commit/ceec8f9ef2ac95285dcc1619ef2ee8e187252beb))
32
+
33
+ ### v13.4.0 (2025-09-29)
34
+
35
+ #### Code refactoring
36
+
37
+ * Update `amqplib` instrumentation to subscribe to events emitted ([#3377](https://github.com/newrelic/node-newrelic/pull/3377)) ([fecbb08](https://github.com/newrelic/node-newrelic/commit/fecbb08d3e3ddc31049aae07537da5d44efaa9e7))
38
+ * Updated `cassandra-driver` instrumentation to subscribe to events emitted. ([#3372](https://github.com/newrelic/node-newrelic/pull/3372)) ([bb87cd8](https://github.com/newrelic/node-newrelic/commit/bb87cd829aacbc66e9caee4f7c494babab742f86))
39
+
40
+ #### Documentation
41
+
42
+ * Updated compatibility report ([#3385](https://github.com/newrelic/node-newrelic/pull/3385)) ([b79be72](https://github.com/newrelic/node-newrelic/commit/b79be723abd29a81c9fa2b635118de44be78c69b))
43
+
44
+ #### Miscellaneous chores
45
+
46
+ * Updated `@apm-js-collab/tracing-hooks` to latest to take advantage of wasm optimizations ([#3398](https://github.com/newrelic/node-newrelic/pull/3398)) ([cda56cc](https://github.com/newrelic/node-newrelic/commit/cda56cc074c421064150163a02a561e69b23a6cb))
47
+
48
+ #### Styles
49
+
50
+ * Require `jsdoc/valid-types` and `jsdoc/check-param-names` ([#3368](https://github.com/newrelic/node-newrelic/pull/3368)) ([5d1b1d9](https://github.com/newrelic/node-newrelic/commit/5d1b1d94a82aaeb877a6fe783becbc8aea6582d6))
51
+ * Require jsdoc `require-param-description` and `require-param-type` ([#3391](https://github.com/newrelic/node-newrelic/pull/3391)) ([3785d0c](https://github.com/newrelic/node-newrelic/commit/3785d0c06cfcc6ac85e23ad4ad21d357e334207b))
52
+
1
53
  ### v13.3.3 (2025-09-22)
2
54
 
3
55
  #### Features
@@ -7906,3 +7958,5 @@ Special thanks to Ryan Copley (@RyanCopley) for the contribution.
7906
7958
 
7907
7959
 
7908
7960
 
7961
+
7962
+
@@ -98,7 +98,7 @@ code, the source code can be found at [https://github.com/newrelic/node-newrelic
98
98
 
99
99
  ### @apm-js-collab/tracing-hooks
100
100
 
101
- This product includes source derived from [@apm-js-collab/tracing-hooks](https://github.com/apm-js-collab/tracing-hooks) ([v0.1.1](https://github.com/apm-js-collab/tracing-hooks/tree/v0.1.1)), distributed under the [Apache-2.0 License](https://github.com/apm-js-collab/tracing-hooks/blob/v0.1.1/LICENSE):
101
+ This product includes source derived from [@apm-js-collab/tracing-hooks](https://github.com/apm-js-collab/tracing-hooks) ([v0.3.1](https://github.com/apm-js-collab/tracing-hooks/tree/v0.3.1)), distributed under the [Apache-2.0 License](https://github.com/apm-js-collab/tracing-hooks/blob/v0.3.1/LICENSE):
102
102
 
103
103
  ```
104
104
 
@@ -308,7 +308,7 @@ This product includes source derived from [@apm-js-collab/tracing-hooks](https:/
308
308
 
309
309
  ### @grpc/grpc-js
310
310
 
311
- This product includes source derived from [@grpc/grpc-js](https://github.com/grpc/grpc-node/tree/master/packages/grpc-js) ([v1.13.4](https://github.com/grpc/grpc-node/tree/master/packages/grpc-js/tree/v1.13.4)), distributed under the [Apache-2.0 License](https://github.com/grpc/grpc-node/tree/master/packages/grpc-js/blob/v1.13.4/LICENSE):
311
+ This product includes source derived from [@grpc/grpc-js](https://github.com/grpc/grpc-node/tree/master/packages/grpc-js) ([v1.14.0](https://github.com/grpc/grpc-node/tree/master/packages/grpc-js/tree/v1.14.0)), distributed under the [Apache-2.0 License](https://github.com/grpc/grpc-node/tree/master/packages/grpc-js/blob/v1.14.0/LICENSE):
312
312
 
313
313
  ```
314
314
  Apache License
@@ -726,7 +726,7 @@ This product includes source derived from [@grpc/proto-loader](https://github.co
726
726
 
727
727
  ### @newrelic/security-agent
728
728
 
729
- This product includes source derived from [@newrelic/security-agent](https://github.com/newrelic/csec-node-agent) ([v2.4.3](https://github.com/newrelic/csec-node-agent/tree/v2.4.3)), distributed under the [UNKNOWN License](https://github.com/newrelic/csec-node-agent/blob/v2.4.3/LICENSE):
729
+ This product includes source derived from [@newrelic/security-agent](https://github.com/newrelic/csec-node-agent) ([v2.4.4](https://github.com/newrelic/csec-node-agent/tree/v2.4.4)), distributed under the [UNKNOWN License](https://github.com/newrelic/csec-node-agent/blob/v2.4.4/LICENSE):
730
730
 
731
731
  ```
732
732
  ## New Relic Software License v1.0
@@ -1190,7 +1190,7 @@ This product includes source derived from [@opentelemetry/api](https://github.co
1190
1190
 
1191
1191
  ### @opentelemetry/core
1192
1192
 
1193
- This product includes source derived from [@opentelemetry/core](https://github.com/open-telemetry/opentelemetry-js) ([v2.0.1](https://github.com/open-telemetry/opentelemetry-js/tree/v2.0.1)), distributed under the [Apache-2.0 License](https://github.com/open-telemetry/opentelemetry-js/blob/v2.0.1/LICENSE):
1193
+ This product includes source derived from [@opentelemetry/core](https://github.com/open-telemetry/opentelemetry-js) ([v2.1.0](https://github.com/open-telemetry/opentelemetry-js/tree/v2.1.0)), distributed under the [Apache-2.0 License](https://github.com/open-telemetry/opentelemetry-js/blob/v2.1.0/LICENSE):
1194
1194
 
1195
1195
  ```
1196
1196
  Apache License
@@ -1608,7 +1608,7 @@ This product includes source derived from [@opentelemetry/exporter-metrics-otlp-
1608
1608
 
1609
1609
  ### @opentelemetry/resources
1610
1610
 
1611
- This product includes source derived from [@opentelemetry/resources](https://github.com/open-telemetry/opentelemetry-js) ([v2.0.1](https://github.com/open-telemetry/opentelemetry-js/tree/v2.0.1)), distributed under the [Apache-2.0 License](https://github.com/open-telemetry/opentelemetry-js/blob/v2.0.1/LICENSE):
1611
+ This product includes source derived from [@opentelemetry/resources](https://github.com/open-telemetry/opentelemetry-js) ([v2.1.0](https://github.com/open-telemetry/opentelemetry-js/tree/v2.1.0)), distributed under the [Apache-2.0 License](https://github.com/open-telemetry/opentelemetry-js/blob/v2.1.0/LICENSE):
1612
1612
 
1613
1613
  ```
1614
1614
  Apache License
@@ -2026,7 +2026,7 @@ This product includes source derived from [@opentelemetry/sdk-logs](https://gith
2026
2026
 
2027
2027
  ### @opentelemetry/sdk-metrics
2028
2028
 
2029
- This product includes source derived from [@opentelemetry/sdk-metrics](https://github.com/open-telemetry/opentelemetry-js) ([v2.0.1](https://github.com/open-telemetry/opentelemetry-js/tree/v2.0.1)), distributed under the [Apache-2.0 License](https://github.com/open-telemetry/opentelemetry-js/blob/v2.0.1/LICENSE):
2029
+ This product includes source derived from [@opentelemetry/sdk-metrics](https://github.com/open-telemetry/opentelemetry-js) ([v2.1.0](https://github.com/open-telemetry/opentelemetry-js/tree/v2.1.0)), distributed under the [Apache-2.0 License](https://github.com/open-telemetry/opentelemetry-js/blob/v2.1.0/LICENSE):
2030
2030
 
2031
2031
  ```
2032
2032
  Apache License
@@ -2235,7 +2235,7 @@ This product includes source derived from [@opentelemetry/sdk-metrics](https://g
2235
2235
 
2236
2236
  ### @opentelemetry/sdk-trace-base
2237
2237
 
2238
- This product includes source derived from [@opentelemetry/sdk-trace-base](https://github.com/open-telemetry/opentelemetry-js) ([v2.0.1](https://github.com/open-telemetry/opentelemetry-js/tree/v2.0.1)), distributed under the [Apache-2.0 License](https://github.com/open-telemetry/opentelemetry-js/blob/v2.0.1/LICENSE):
2238
+ This product includes source derived from [@opentelemetry/sdk-trace-base](https://github.com/open-telemetry/opentelemetry-js) ([v2.1.0](https://github.com/open-telemetry/opentelemetry-js/tree/v2.1.0)), distributed under the [Apache-2.0 License](https://github.com/open-telemetry/opentelemetry-js/blob/v2.1.0/LICENSE):
2239
2239
 
2240
2240
  ```
2241
2241
  Apache License
@@ -2533,7 +2533,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2533
2533
 
2534
2534
  ### import-in-the-middle
2535
2535
 
2536
- This product includes source derived from [import-in-the-middle](https://github.com/nodejs/import-in-the-middle) ([v1.14.2](https://github.com/nodejs/import-in-the-middle/tree/v1.14.2)), distributed under the [Apache-2.0 License](https://github.com/nodejs/import-in-the-middle/blob/v1.14.2/LICENSE):
2536
+ This product includes source derived from [import-in-the-middle](https://github.com/nodejs/import-in-the-middle) ([v1.14.4](https://github.com/nodejs/import-in-the-middle/tree/v1.14.4)), distributed under the [Apache-2.0 License](https://github.com/nodejs/import-in-the-middle/blob/v1.14.4/LICENSE):
2537
2537
 
2538
2538
  ```
2539
2539
  Apache License
@@ -2964,7 +2964,7 @@ SOFTWARE.
2964
2964
 
2965
2965
  ### @aws-sdk/client-s3
2966
2966
 
2967
- This product includes source derived from [@aws-sdk/client-s3](https://github.com/aws/aws-sdk-js-v3) ([v3.872.0](https://github.com/aws/aws-sdk-js-v3/tree/v3.872.0)), distributed under the [Apache-2.0 License](https://github.com/aws/aws-sdk-js-v3/blob/v3.872.0/LICENSE):
2967
+ This product includes source derived from [@aws-sdk/client-s3](https://github.com/aws/aws-sdk-js-v3) ([v3.896.0](https://github.com/aws/aws-sdk-js-v3/tree/v3.896.0)), distributed under the [Apache-2.0 License](https://github.com/aws/aws-sdk-js-v3/blob/v3.896.0/LICENSE):
2968
2968
 
2969
2969
  ```
2970
2970
  Apache License
@@ -3173,7 +3173,7 @@ This product includes source derived from [@aws-sdk/client-s3](https://github.co
3173
3173
 
3174
3174
  ### @aws-sdk/s3-request-presigner
3175
3175
 
3176
- This product includes source derived from [@aws-sdk/s3-request-presigner](https://github.com/aws/aws-sdk-js-v3) ([v3.872.0](https://github.com/aws/aws-sdk-js-v3/tree/v3.872.0)), distributed under the [Apache-2.0 License](https://github.com/aws/aws-sdk-js-v3/blob/v3.872.0/LICENSE):
3176
+ This product includes source derived from [@aws-sdk/s3-request-presigner](https://github.com/aws/aws-sdk-js-v3) ([v3.896.0](https://github.com/aws/aws-sdk-js-v3/tree/v3.896.0)), distributed under the [Apache-2.0 License](https://github.com/aws/aws-sdk-js-v3/blob/v3.896.0/LICENSE):
3177
3177
 
3178
3178
  ```
3179
3179
  Apache License
@@ -5033,7 +5033,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5033
5033
 
5034
5034
  ### eslint
5035
5035
 
5036
- This product includes source derived from [eslint](https://github.com/eslint/eslint) ([v9.33.0](https://github.com/eslint/eslint/tree/v9.33.0)), distributed under the [MIT License](https://github.com/eslint/eslint/blob/v9.33.0/LICENSE):
5036
+ This product includes source derived from [eslint](https://github.com/eslint/eslint) ([v9.36.0](https://github.com/eslint/eslint/tree/v9.36.0)), distributed under the [MIT License](https://github.com/eslint/eslint/blob/v9.36.0/LICENSE):
5037
5037
 
5038
5038
  ```
5039
5039
  Copyright OpenJS Foundation and other contributors, <www.openjsf.org>
package/api.js CHANGED
@@ -1937,7 +1937,7 @@ API.prototype.ignoreApdex = function ignoreApdex() {
1937
1937
  * { role: 'user', content: 'Tell me about Node.js.'}
1938
1938
  * ]})
1939
1939
  * })
1940
- * @param {Object} context LLM custom attributes context
1940
+ * @param {object} context LLM custom attributes context
1941
1941
  * @param {Function} callback The function to execute in context.
1942
1942
  */
1943
1943
  API.prototype.withLlmCustomAttributes = function withLlmCustomAttributes(context, callback) {
package/esm-loader.mjs CHANGED
@@ -9,10 +9,10 @@ import subscriptions from './lib/subscriber-configs.js'
9
9
  import createSubscriberConfigs from './lib/subscribers/create-config.js'
10
10
  // Exclusions must be regexes
11
11
  const exclusions = [/@openai\/agents.*/]
12
- const { packages, instrumentations } = createSubscriberConfigs(subscriptions)
12
+ const { instrumentations } = createSubscriberConfigs(subscriptions)
13
13
 
14
14
  register('@apm-js-collab/tracing-hooks/hook.mjs', import.meta.url, {
15
- data: { instrumentations, packages }
15
+ data: { instrumentations }
16
16
  })
17
17
  register('import-in-the-middle/hook.mjs', import.meta.url, {
18
18
  data: { exclude: exclusions }
package/lib/agent.js CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  'use strict'
7
7
 
8
- const AdaptiveSampler = require('./adaptive-sampler')
8
+ const AdaptiveSampler = require('./samplers/adaptive-sampler')
9
9
  const CollectorAPI = require('./collector/api')
10
10
  const ServerlessCollector = require('./collector/serverless')
11
11
  const DESTINATIONS = require('./config/attribute-filter').DESTINATIONS
@@ -169,7 +169,7 @@ const DEFAULT_HARVEST_INTERVAL_MS = 60000
169
169
  * available. Don't try to recover here, because without configuration the
170
170
  * agent can't be brought up to a useful state.
171
171
  *
172
- * @param {object} config Agent configuration object
172
+ * @param {Config} config Agent configuration object
173
173
  */
174
174
  function Agent(config) {
175
175
  EventEmitter.call(this)
@@ -85,8 +85,6 @@ class EventAggregator extends Aggregator {
85
85
 
86
86
  /**
87
87
  * Resets the contents of the aggregator and all counters.
88
- *
89
- * @returns {PriorityQueue} The old collection of aggregated events.
90
88
  */
91
89
  clearEvents() {
92
90
  // ???: might be more efficient to clear here and come up with an efficient way to
package/lib/attributes.js CHANGED
@@ -68,7 +68,7 @@ class Attributes {
68
68
  * in the list of allowed destinations. If there is a limit on the number of
69
69
  * attributes allowed, no more than that number will be included in the result.
70
70
  *
71
- * @param {AttributeFilter.DESTINATIONS} dest
71
+ * @param {AttributeFilter.DESTINATIONS} dest - Allowed destinations
72
72
  * @returns {object}
73
73
  */
74
74
  get(dest) {
@@ -92,7 +92,7 @@ class Attributes {
92
92
  /**
93
93
  * Checks if a given key exists in the instance attributes object.
94
94
  *
95
- * @param {string} key
95
+ * @param {string} key the key to check
96
96
  */
97
97
  has(key) {
98
98
  return !!this.attributes[key]
@@ -163,8 +163,8 @@ class Attributes {
163
163
  * Returns true if a given key is valid for any of the
164
164
  * provided destinations.
165
165
  *
166
- * @param {DESTINATIONS} destinations
167
- * @param {string} key
166
+ * @param {DESTINATIONS} destinations - The destinations to check against.
167
+ * @param {string} key the key to check
168
168
  */
169
169
  hasValidDestination(destinations, key) {
170
170
  const validDestinations = this.filter(destinations, key)
@@ -176,8 +176,8 @@ class Attributes {
176
176
  * Creates a filter function for the given scope.
177
177
  *
178
178
  * @param {string} scope - The scope of the filter to make.
179
- * @returns {Function} A function that performs attribute filtering for the given
180
- * scope.
179
+ * @returns {Function|undefined} A function that performs attribute filtering for the given
180
+ * scope, or undefined if the scope is not recognized.
181
181
  */
182
182
  function makeFilter(scope) {
183
183
  const { attributeFilter } = Config.getInstance()
@@ -153,7 +153,7 @@ CollectorAPI.prototype._updateEndpoints = function _updateEndpoints(endpoint) {
153
153
  /**
154
154
  * Connect to the data collector.
155
155
  *
156
- * @param {function} callback A typical error first callback to be invoked
156
+ * @param {Function} callback A typical error first callback to be invoked
157
157
  * upon successful or unsuccessful connection. The second parameter will be
158
158
  * an instance of {@link CollectorResponse}.
159
159
  *
@@ -130,7 +130,7 @@ function getAllIPAddresses() {
130
130
  * connections are the same real agent or a separate one.
131
131
  * https://github.com/newrelic/node-newrelic/issues/654
132
132
  *
133
- * @param appNames
133
+ * @param {Array<string>} appNames list of app names
134
134
  */
135
135
  function getIdentifierOverride(appNames) {
136
136
  return [
@@ -19,7 +19,7 @@ let agentProxyWithKeepAlive = null
19
19
  /**
20
20
  * Returns an HTTP agent with keep-alive enabled
21
21
  *
22
- * @param config
22
+ * @param {object} config configuration for HTTP agent
23
23
  */
24
24
  exports.keepAliveAgent = function keepAliveAgent(config) {
25
25
  config = config ? config : {}
@@ -45,7 +45,7 @@ exports.keepAliveAgent = function keepAliveAgent(config) {
45
45
  * to the proxy server as to how its connection is made
46
46
  * with New Relic's servers.
47
47
  *
48
- * @param config
48
+ * @param {object} config configuration for proxy agent
49
49
  */
50
50
  exports.proxyAgent = function proxyAgent(config) {
51
51
  if (agentProxyWithKeepAlive !== null) {
@@ -16,18 +16,15 @@ const logger = require('../logger').child({ component: 'new_relic_response' })
16
16
  * about errors as possible, and to parse out the return value as often
17
17
  * as possible.
18
18
  *
19
- * @param string name Remote method name that was invoked.
20
- * @param ServerResponse response HTTP response stream
21
- * @param Function callback Function that will be called with any
22
- * error, the value returned by the server
23
- * (if any), and the raw JSON of the
24
- * server's response.
25
- * @param name
26
- * @param response
27
- * @param callback
28
- * @returns Function Another callback that is meant to be invoked with
29
- * any errors from reading the response stream, as
30
- * well as a string containing the full response.
19
+ * @param {string} name Remote method name that was invoked.
20
+ * @param {ServerResponse} response HTTP response stream
21
+ * @param {Function} callback Function that will be called with any
22
+ * error, the value returned by the server
23
+ * (if any), and the raw JSON of the
24
+ * server's response.
25
+ * @returns {Function} Another callback that is meant to be invoked with
26
+ * any errors from reading the response stream, as
27
+ * well as a string containing the full response.
31
28
  */
32
29
  module.exports = function parse(name, response, callback) {
33
30
  if (!callback) {
@@ -128,9 +128,8 @@ RemoteMethod.prototype.invoke = function invoke(payload, nrHeaders, callback) {
128
128
  * Take a serialized payload and create a response wrapper for it before
129
129
  * invoking the method on the collector.
130
130
  *
131
- * @param {string} methodName Name of method to invoke on collector.
132
131
  * @param {string} data Serialized payload.
133
- * @param {?object} nrHeaders NR request headers from connect response.
132
+ * @param {object} nrHeaders NR request headers from connect response.
134
133
  * @param {Function} callback What to do next. Gets passed any error.
135
134
  */
136
135
  RemoteMethod.prototype._post = function _post(data, nrHeaders, callback) {
@@ -282,6 +281,7 @@ RemoteMethod.prototype._safeRequest = function _safeRequest(options) {
282
281
  * Generate the request headers and wire up the request. There are many
283
282
  * parameters used to make a request:
284
283
  *
284
+ * @param {object} options options object
285
285
  * @param {string} options.host Hostname (or proxy hostname) for collector.
286
286
  * @param {string} options.port Port (or proxy port) for collector.
287
287
  * @param {string} options.path URL path for method being invoked on collector.
@@ -292,7 +292,6 @@ RemoteMethod.prototype._safeRequest = function _safeRequest(options) {
292
292
  * original callback given to .send).
293
293
  * @param {Function} options.onResponse Response handler for this request (created by
294
294
  * ._post).
295
- * @param options
296
295
  */
297
296
  RemoteMethod.prototype._request = function _request(options) {
298
297
  const requestOptions = {
@@ -364,7 +363,7 @@ RemoteMethod.prototype._path = function _path({ redactLicenseKey } = {}) {
364
363
  }
365
364
 
366
365
  /**
367
- * @param {object} options
366
+ * @param {object} options options object
368
367
  * @param {number} options.body - Data to be sent.
369
368
  * @param {object} options.nrHeaders - NR request headers from the connect response.
370
369
  * @param {boolean} options.compressed - The compression method used, if any.
@@ -402,7 +401,7 @@ RemoteMethod.prototype._headers = function _headers(options) {
402
401
  *
403
402
  * FIXME: come up with a better heuristic
404
403
  *
405
- * @param data
404
+ * @param {*} data the data that might get compressed
406
405
  */
407
406
  RemoteMethod.prototype._shouldCompress = function _shouldCompress(data) {
408
407
  return data && byteLength(data) > 65536
@@ -110,7 +110,7 @@ class ServerlessCollector {
110
110
  * Constructs, serializes, and prints the final consolidated payload to stdout.
111
111
  *
112
112
  * @param {Function} cb The callback to invoke when finished.
113
- * @returns {boolean} indicating if callback was defined and successfully executed
113
+ * @returns {boolean|undefined} indicating if callback was defined and successfully executed
114
114
  */
115
115
  flushPayload(cb) {
116
116
  if (!this.enabled) {
@@ -12,18 +12,28 @@ const corePkgs = Object.keys(coreLibraries)
12
12
  const subscriptions = require('../subscriber-configs')
13
13
  const subscribers = Object.keys(subscriptions)
14
14
  pkgNames.push(...subscribers)
15
- // Manually adding undici as it is registered separately in shimmer
16
- corePkgs.push('undici')
17
15
  // Manually adding domain as it is registered separately in shimmer
18
16
  corePkgs.push('domain')
19
17
  pkgNames.push(...corePkgs)
20
18
 
19
+ // Packages are normally enabled without any extra
20
+ // configuration. This list is a set of packages that
21
+ // we want to be disabled without any extra configuration.
22
+ // Typically, this is because the instrumentation no longer
23
+ // provides useful data. Users can still enable them if they
24
+ // are interested in the instrumentation they provide.
25
+ const disabledPkgs = ['timers']
26
+
21
27
  /**
22
28
  * Builds the stanza for config.instrumentation.*
23
29
  * It defaults every library to true and assigns a boolean
24
30
  * formatter for the environment variable conversion of the values
25
31
  */
26
32
  module.exports = pkgNames.reduce((config, pkg) => {
27
- config[pkg] = { enabled: { formatter: boolean, default: true } }
33
+ let defaultValue = true
34
+ if (disabledPkgs.includes(pkg)) {
35
+ defaultValue = false
36
+ }
37
+ config[pkg] = { enabled: { formatter: boolean, default: defaultValue } }
28
38
  return config
29
39
  }, {})
@@ -1156,16 +1156,27 @@ defaultConfig.definition = () => {
1156
1156
  },
1157
1157
 
1158
1158
  sampler: {
1159
- /**
1160
- * When set to `always_on`, the sampled flag in the `traceparent` header
1161
- * being set to "true" will result in the local transaction being sampled
1162
- * with a priority value of "2". When set to `always_off`, the local
1163
- * transaction will never be sampled. At the default setting, the sampling
1164
- * decision will be determined according to the normal algorithm.
1165
- *
1166
- * This setting takes precedence over the `remote_parent_not_sampled`
1167
- * setting.
1168
- */
1159
+ /**
1160
+ * The sampling target for adaptive sampling is controlled via this attribute when configuring the default/adaptive sampler.
1161
+ * The default sampling target is 10 transactions/min when it is not specified but **MUST** be within the range of [1, 120] (inclusive).
1162
+ * Upon agent connect, the connect response **MUST** provide the value of `sampling_target` based on this configuration setting's value.
1163
+ * The `sampling_target` value from the connect response **SHOULD** be used as the sampling target value for adaptive sampling in the agent.
1164
+ */
1165
+ adaptive_sampling_target: {
1166
+ formatter: int,
1167
+ default: 10
1168
+ },
1169
+
1170
+ /**
1171
+ * When set to `always_on`, the sampled flag in the `traceparent` header
1172
+ * being set to "true" will result in the local transaction being sampled
1173
+ * with a priority value of "2". When set to `always_off`, the local
1174
+ * transaction will never be sampled. At the default setting, the sampling
1175
+ * decision will be determined according to the normal algorithm.
1176
+ *
1177
+ * This setting takes precedence over the `remote_parent_not_sampled`
1178
+ * setting.
1179
+ */
1169
1180
  remote_parent_sampled: {
1170
1181
  formatter: allowList.bind(null, ['always_on', 'always_off', 'default']),
1171
1182
  default: 'default'
@@ -10,7 +10,7 @@ const formatters = module.exports
10
10
  * Splits a string by a ',' and trims whitespace
11
11
  *
12
12
  * @param {string} val config setting
13
- * @param {Array}
13
+ * @returns {Array}
14
14
  */
15
15
  formatters.array = function array(val) {
16
16
  return val.split(',').map((k) => k.trim())
@@ -39,8 +39,7 @@ formatters.float = function float(val) {
39
39
  /**
40
40
  * Parses a config setting as a boolean
41
41
  *
42
- * @param {string} val config setting
43
- * @param setting
42
+ * @param {string} setting value of config setting
44
43
  * @returns {boolean}
45
44
  */
46
45
  formatters.boolean = function boolean(setting) {
@@ -68,7 +67,7 @@ formatters.boolean = function boolean(setting) {
68
67
  *
69
68
  * @param {string} val config setting
70
69
  * @param {logger} logger agent logger instance
71
- * @returns {object}
70
+ * @returns {object|undefined} the parsed value, or undefined if an error occurred
72
71
  */
73
72
  formatters.object = function object(val, logger) {
74
73
  try {
@@ -84,7 +83,7 @@ formatters.object = function object(val, logger) {
84
83
  *
85
84
  * @param {string} val config setting
86
85
  * @param {logger} logger agent logger instance
87
- * @returns {Array}
86
+ * @returns {Array|undefined} The parsed array of objects, or undefined if an error occurred
88
87
  */
89
88
  formatters.objectList = function objectList(val, logger) {
90
89
  try {
@@ -112,7 +111,7 @@ formatters.allowList = function allowList(list, val) {
112
111
  *
113
112
  * @param {string} val valid regex
114
113
  * @param {logger} logger agent logger instance
115
- * @returns {RegExp} regex
114
+ * @returns {RegExp|undefined} regex, or undefined if an error occurred
116
115
  */
117
116
  formatters.regex = function regex(val, logger) {
118
117
  try {