newrelic 13.3.2 → 13.4.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 +43 -0
- package/THIRD_PARTY_NOTICES.md +11 -11
- package/esm-loader.mjs +2 -2
- package/lib/attributes.js +4 -4
- package/lib/collector/facts.js +1 -1
- package/lib/collector/http-agents.js +2 -2
- package/lib/collector/parse-response.js +9 -12
- package/lib/collector/remote-method.js +4 -5
- package/lib/config/formatters.js +2 -3
- package/lib/config/index.js +6 -6
- package/lib/harvester.js +1 -1
- package/lib/header-processing.js +3 -3
- package/lib/instrumentation/@node-redis/client.js +1 -1
- package/lib/instrumentation/aws-sdk/v2/instrumentation-helper.js +2 -2
- package/lib/instrumentation/aws-sdk/v3/common.js +5 -5
- package/lib/instrumentation/aws-sdk/v3/dynamodb.js +4 -4
- package/lib/instrumentation/aws-sdk/v3/sns.js +9 -9
- package/lib/instrumentation/aws-sdk/v3/sqs.js +6 -6
- package/lib/instrumentation/core/http-outbound.js +1 -2
- package/lib/instrumentation/fastify/spec-builders.js +11 -11
- package/lib/instrumentation/fastify.js +4 -4
- package/lib/instrumentation/memcached.js +4 -4
- package/lib/instrumentation/mongodb.js +2 -2
- package/lib/instrumentation/undici.js +3 -3
- package/lib/instrumentations.js +0 -2
- package/lib/llm-events/aws-bedrock/bedrock-response.js +6 -6
- package/lib/llm-events/aws-bedrock/converse-stream-handler.js +1 -1
- package/lib/llm-events/aws-bedrock/stream-handler.js +4 -4
- package/lib/metrics/index.js +2 -2
- package/lib/metrics/normalizer/rule.js +1 -1
- package/lib/metrics/normalizer.js +4 -5
- package/lib/metrics/recorders/message-transaction.js +3 -3
- package/lib/otel/context-manager.js +4 -4
- package/lib/otel/metrics/index.js +3 -3
- package/lib/otel/setup.js +6 -0
- package/lib/otel/trace-propagator.js +1 -1
- package/lib/otel/traces/index.js +1 -1
- package/lib/prioritized-attributes.js +2 -2
- package/lib/serverless/aws-lambda.js +4 -4
- package/lib/shim/datastore-shim.js +1 -1
- package/lib/shim/message-shim/consume.js +1 -1
- package/lib/shim/message-shim/subscribe-consume.js +1 -2
- package/lib/shim/promise-shim.js +1 -3
- package/lib/shim/shim.js +3 -4
- package/lib/shim/transaction-shim.js +0 -1
- package/lib/shim/webframework-shim/common.js +2 -4
- package/lib/shim/webframework-shim/middleware.js +8 -8
- package/lib/spans/span-context.js +1 -1
- package/lib/spans/span-event-aggregator.js +2 -2
- package/lib/spans/span-event.js +6 -5
- package/lib/spans/streaming-span-attributes.js +1 -1
- package/lib/spans/streaming-span-event-aggregator.js +1 -2
- package/lib/stats/index.js +1 -1
- package/lib/subscriber-configs.js +2 -0
- package/lib/subscribers/amqplib/accept-message.js +14 -0
- package/lib/subscribers/amqplib/callback-model.js +39 -0
- package/lib/subscribers/amqplib/channel-model.js +39 -0
- package/lib/subscribers/amqplib/config.js +695 -0
- package/lib/subscribers/amqplib/connect.js +74 -0
- package/lib/subscribers/amqplib/consume.js +54 -0
- package/lib/subscribers/amqplib/get-cb.js +16 -0
- package/lib/subscribers/amqplib/get.js +50 -0
- package/lib/subscribers/amqplib/purge-queue-cb.js +16 -0
- package/lib/subscribers/amqplib/purge-queue.js +37 -0
- package/lib/subscribers/amqplib/send-message.js +44 -0
- package/lib/subscribers/amqplib/send-or-enqueue.js +20 -0
- package/lib/subscribers/amqplib/utils.js +53 -0
- package/lib/subscribers/application-logs.js +1 -1
- package/lib/subscribers/base.js +167 -9
- package/lib/subscribers/cassandra-driver/client-batch.js +49 -0
- package/lib/subscribers/cassandra-driver/client-connect.js +35 -0
- package/lib/subscribers/cassandra-driver/client-each-row.js +36 -0
- package/lib/subscribers/cassandra-driver/client-execute.js +36 -0
- package/lib/subscribers/cassandra-driver/client-shutdown.js +32 -0
- package/lib/subscribers/cassandra-driver/config.js +145 -0
- package/lib/subscribers/cassandra-driver/legacy-client-batch.js +22 -0
- package/lib/subscribers/cassandra-driver/legacy-client-connect.js +22 -0
- package/lib/subscribers/cassandra-driver/legacy-client-each-row.js +22 -0
- package/lib/subscribers/cassandra-driver/legacy-client-execute.js +21 -0
- package/lib/subscribers/cassandra-driver/legacy-client-shutdown.js +32 -0
- package/lib/subscribers/create-config.js +2 -4
- package/lib/subscribers/db-query.js +5 -1
- package/lib/subscribers/message-consumer.js +146 -0
- package/lib/subscribers/message-producer.js +60 -0
- package/lib/subscribers/meta-subscriber.js +69 -0
- package/lib/subscribers/openai/base.js +27 -1
- package/lib/subscribers/openai/config.js +6 -6
- package/lib/subscribers/openai/utils.js +9 -11
- package/lib/subscribers/propagation.js +43 -0
- package/lib/timer.js +1 -1
- package/lib/transaction/dt-payload.js +1 -1
- package/lib/transaction/handle.js +8 -9
- package/lib/transaction/name-state.js +11 -11
- package/lib/transaction/trace/segment.js +2 -3
- package/lib/util/attribute-types.js +1 -1
- package/lib/util/byte-limit.js +1 -1
- package/lib/util/cat.js +13 -13
- package/lib/util/flatten.js +2 -3
- package/lib/util/is-absolute-path.js +1 -1
- package/lib/util/is-string.js +15 -0
- package/lib/util/logger.js +6 -6
- package/lib/util/stream-sink.js +1 -1
- package/lib/utilization/docker-info.js +4 -3
- package/lib/w3c/traceparent.js +1 -1
- package/package.json +2 -2
- package/lib/instrumentation/amqplib/amqplib.js +0 -122
- package/lib/instrumentation/amqplib/channel-model.js +0 -124
- package/lib/instrumentation/amqplib/channel.js +0 -72
- package/lib/instrumentation/amqplib/nr-hooks.js +0 -21
- package/lib/instrumentation/amqplib/utils.js +0 -143
- package/lib/instrumentation/cassandra-driver.js +0 -131
package/NEWS.md
CHANGED
|
@@ -1,3 +1,43 @@
|
|
|
1
|
+
### v13.4.0 (2025-09-29)
|
|
2
|
+
|
|
3
|
+
#### Code refactoring
|
|
4
|
+
|
|
5
|
+
* 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))
|
|
6
|
+
* 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))
|
|
7
|
+
|
|
8
|
+
#### Documentation
|
|
9
|
+
|
|
10
|
+
* Updated compatibility report ([#3385](https://github.com/newrelic/node-newrelic/pull/3385)) ([b79be72](https://github.com/newrelic/node-newrelic/commit/b79be723abd29a81c9fa2b635118de44be78c69b))
|
|
11
|
+
|
|
12
|
+
#### Miscellaneous chores
|
|
13
|
+
|
|
14
|
+
* 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))
|
|
15
|
+
|
|
16
|
+
#### Styles
|
|
17
|
+
|
|
18
|
+
* 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))
|
|
19
|
+
* 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))
|
|
20
|
+
|
|
21
|
+
### v13.3.3 (2025-09-22)
|
|
22
|
+
|
|
23
|
+
#### Features
|
|
24
|
+
|
|
25
|
+
* Added support for tracing callback on subscribers ([#3371](https://github.com/newrelic/node-newrelic/pull/3371)) ([e6ad52e](https://github.com/newrelic/node-newrelic/commit/e6ad52e1f897ec757e90f9fc12f592e1c6eec2fe))
|
|
26
|
+
|
|
27
|
+
#### Bug fixes
|
|
28
|
+
|
|
29
|
+
* Updated `openai` instrumentation to properly return APIPromise to avoid crashing when using `completions.parse` or `responses.parse` ([#3382](https://github.com/newrelic/node-newrelic/pull/3382)) ([c7ccf26](https://github.com/newrelic/node-newrelic/commit/c7ccf260ffc9c788bde73b43231b716199724d09))
|
|
30
|
+
|
|
31
|
+
#### Documentation
|
|
32
|
+
|
|
33
|
+
* Updated compatibility report ([#3370](https://github.com/newrelic/node-newrelic/pull/3370)) ([754c2f0](https://github.com/newrelic/node-newrelic/commit/754c2f089339268fb73a3ff7765a630ea8982d0d))
|
|
34
|
+
|
|
35
|
+
#### Miscellaneous chores
|
|
36
|
+
|
|
37
|
+
* Removed unused `loader.mjs` ([#3376](https://github.com/newrelic/node-newrelic/pull/3376)) ([66a9fd5](https://github.com/newrelic/node-newrelic/commit/66a9fd543d1a7854b7405c7b5b884d8a71773b85))
|
|
38
|
+
* Updated metrics for OTel Bridge enablement/disablement ([#3381](https://github.com/newrelic/node-newrelic/pull/3381)) ([b976c37](https://github.com/newrelic/node-newrelic/commit/b976c376fe187bda5bde1b8cd4b86a7de86fe4f9))
|
|
39
|
+
* Updated supportability metric names for OTel Bridge enablement… ([#3383](https://github.com/newrelic/node-newrelic/pull/3383)) ([c7c1d6c](https://github.com/newrelic/node-newrelic/commit/c7c1d6c942c6b53fd944e2259b42d1e7e7be483a))
|
|
40
|
+
|
|
1
41
|
### v13.3.2 (2025-09-10)
|
|
2
42
|
|
|
3
43
|
#### Bug fixes
|
|
@@ -7885,3 +7925,6 @@ Special thanks to Ryan Copley (@RyanCopley) for the contribution.
|
|
|
7885
7925
|
|
|
7886
7926
|
|
|
7887
7927
|
|
|
7928
|
+
|
|
7929
|
+
|
|
7930
|
+
|
package/THIRD_PARTY_NOTICES.md
CHANGED
|
@@ -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.
|
|
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.
|
|
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.
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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/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 {
|
|
12
|
+
const { instrumentations } = createSubscriberConfigs(subscriptions)
|
|
13
13
|
|
|
14
14
|
register('@apm-js-collab/tracing-hooks/hook.mjs', import.meta.url, {
|
|
15
|
-
data: { instrumentations
|
|
15
|
+
data: { instrumentations }
|
|
16
16
|
})
|
|
17
17
|
register('import-in-the-middle/hook.mjs', import.meta.url, {
|
|
18
18
|
data: { exclude: exclusions }
|
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)
|
package/lib/collector/facts.js
CHANGED
|
@@ -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
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* @
|
|
26
|
-
*
|
|
27
|
-
*
|
|
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 {
|
|
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
|
package/lib/config/formatters.js
CHANGED
|
@@ -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
|
-
* @
|
|
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}
|
|
43
|
-
* @param setting
|
|
42
|
+
* @param {string} setting value of config setting
|
|
44
43
|
* @returns {boolean}
|
|
45
44
|
*/
|
|
46
45
|
formatters.boolean = function boolean(setting) {
|
package/lib/config/index.js
CHANGED
|
@@ -1529,8 +1529,8 @@ function _laspReponse(keys) {
|
|
|
1529
1529
|
/**
|
|
1530
1530
|
* Applies the server side LASP policies to a local configuration object
|
|
1531
1531
|
*
|
|
1532
|
-
* @param agent
|
|
1533
|
-
* @param {
|
|
1532
|
+
* @param {Agent} agent Agent instance
|
|
1533
|
+
* @param {bject} policies server side LASP policy
|
|
1534
1534
|
* @returns {object} { missingRequired, finalPolicies } list of missing required fields and finalized LASP policy
|
|
1535
1535
|
*/
|
|
1536
1536
|
Config.prototype._buildLaspPolicy = function _buildLaspPolicy(agent, policies) {
|
|
@@ -1595,7 +1595,7 @@ Config.prototype._buildLaspPolicy = function _buildLaspPolicy(agent, policies) {
|
|
|
1595
1595
|
* by the agent, if LASP-enabled. Responds with an error to shut down
|
|
1596
1596
|
* the agent if necessary.
|
|
1597
1597
|
*
|
|
1598
|
-
* @param agent
|
|
1598
|
+
* @param {Agent} agent Agent instance
|
|
1599
1599
|
* @param {object} policies lasp policy
|
|
1600
1600
|
* @returns {CollectorResponse} The result of the processing, with the known
|
|
1601
1601
|
* policies as the response payload.
|
|
@@ -1745,9 +1745,9 @@ Config.prototype._warnDeprecations = function _warnDeprecations() {
|
|
|
1745
1745
|
* the environment variables will override their corresponding
|
|
1746
1746
|
* configuration file settings.
|
|
1747
1747
|
*
|
|
1748
|
-
* @param {object} config Optional configuration to be used in place of a config file.
|
|
1749
|
-
* @param
|
|
1750
|
-
* @param
|
|
1748
|
+
* @param {object} [config] Optional configuration to be used in place of a config file.
|
|
1749
|
+
* @param {object} [deps] Optional dependencies
|
|
1750
|
+
* @param {object} [deps.loggerInstance] Logger instance
|
|
1751
1751
|
* @returns {object} instantiated configuration object
|
|
1752
1752
|
*/
|
|
1753
1753
|
function initialize(config, { loggerInstance } = {}) {
|
package/lib/harvester.js
CHANGED
package/lib/header-processing.js
CHANGED
|
@@ -15,8 +15,8 @@ const CONTENT_LENGTH_REGEX = /^Content-Length$/i
|
|
|
15
15
|
* Queue time is provided by certain providers by stamping the request
|
|
16
16
|
* header with the time the request arrived at the router.
|
|
17
17
|
*
|
|
18
|
-
* @param {
|
|
19
|
-
* @param {
|
|
18
|
+
* @param {Object} logger Logger instance
|
|
19
|
+
* @param {Object} requestHeaders Incoming request headers
|
|
20
20
|
*/
|
|
21
21
|
function getQueueTime(logger, requestHeaders) {
|
|
22
22
|
const headerValue = requestHeaders[REQUEST_START_HEADER] || requestHeaders[QUEUE_HEADER]
|
|
@@ -62,7 +62,7 @@ function convertUnit(time) {
|
|
|
62
62
|
*
|
|
63
63
|
* If no header is found, returns -1
|
|
64
64
|
*
|
|
65
|
-
* @param {
|
|
65
|
+
* @param {Object} headers Incoming request headers
|
|
66
66
|
*/
|
|
67
67
|
function getContentLengthFromHeaders(headers) {
|
|
68
68
|
const contentLength = -1
|
|
@@ -43,7 +43,7 @@ module.exports = function initialize(_agent, redis, _moduleName, shim) {
|
|
|
43
43
|
/**
|
|
44
44
|
* Instruments a given command when added to the command queue by calling `shim.recordOperation`
|
|
45
45
|
*
|
|
46
|
-
* @param {object} params
|
|
46
|
+
* @param {object} params params object
|
|
47
47
|
* @param {Shim} params.shim shim instance
|
|
48
48
|
* @param {object} params.commandsQueue instance
|
|
49
49
|
*/
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Series of tests to determine if the library
|
|
10
|
-
* has the features needed to provide instrumentation
|
|
11
|
-
* @param AWS
|
|
10
|
+
* has the features needed to provide instrumentation.
|
|
11
|
+
* @param {Object} AWS AWS SDK object
|
|
12
12
|
*/
|
|
13
13
|
const instrumentationSupported = function instrumentationSupported(AWS) {
|
|
14
14
|
// instrumentation requires the serviceClientOperationsMap property
|
|
@@ -12,8 +12,8 @@ const InstrumentationDescriptor = require('../../../instrumentation-descriptor')
|
|
|
12
12
|
* Wraps the build middleware step to add the disable DT
|
|
13
13
|
* header to all outgoing requests
|
|
14
14
|
*
|
|
15
|
-
* @param {Shim} shim
|
|
16
|
-
* @param config
|
|
15
|
+
* @param {Shim} shim instance
|
|
16
|
+
* @param {Object} config configuration options
|
|
17
17
|
* @param {function} next next function in middleware chain
|
|
18
18
|
* @returns {function}
|
|
19
19
|
*
|
|
@@ -31,7 +31,7 @@ function headerMiddleware(shim, config, next) {
|
|
|
31
31
|
* Wraps the deserialize middleware step to add the
|
|
32
32
|
* appropriate segment attributes for the AWS command
|
|
33
33
|
*
|
|
34
|
-
* @param {Shim} shim
|
|
34
|
+
* @param {Shim} shim instance
|
|
35
35
|
* @param {Object} config AWS command configuration
|
|
36
36
|
* @param {function} next next function in middleware chain
|
|
37
37
|
* @param {Object} context AWS command context
|
|
@@ -55,11 +55,11 @@ function attrMiddleware(shim, config, next, context) {
|
|
|
55
55
|
* Adds the necessary aws.* attributes to either the External or first
|
|
56
56
|
* class operation segment
|
|
57
57
|
*
|
|
58
|
-
* @param {Object} params
|
|
58
|
+
* @param {Object} params params object
|
|
59
59
|
* @param {Object} params.result result from middleware
|
|
60
60
|
* @param {Object} params.config AWS config
|
|
61
61
|
* @param {string} params.region AWS region
|
|
62
|
-
* @param {Shim} params.shim
|
|
62
|
+
* @param {Shim} params.shim Shim instance
|
|
63
63
|
* @param {Object} params.context smithy client context
|
|
64
64
|
*/
|
|
65
65
|
function addAwsAttributes({ result, config, region, shim, context }) {
|
|
@@ -11,7 +11,7 @@ const InstrumentationDescriptor = require('../../../instrumentation-descriptor')
|
|
|
11
11
|
/**
|
|
12
12
|
* Returns the spec for Dynamo commands
|
|
13
13
|
*
|
|
14
|
-
* @param {Shim} shim
|
|
14
|
+
* @param {Shim} shim Shim instance
|
|
15
15
|
* @param {original} original Original middleware function
|
|
16
16
|
* @param {String} name Name of the calling function
|
|
17
17
|
* @param {Array} args Arguments for the middleware function
|
|
@@ -35,7 +35,7 @@ function getDynamoSpec(shim, original, name, args) {
|
|
|
35
35
|
* unless you provide an endpoint override to your library constructor
|
|
36
36
|
* This function will derive the endpoint in that scenario by grabbing the region
|
|
37
37
|
* and building the URL
|
|
38
|
-
* @param config
|
|
38
|
+
* @param {Object} config configuration options
|
|
39
39
|
*/
|
|
40
40
|
async function getEndpoint(config) {
|
|
41
41
|
if (typeof config.endpoint === 'function') {
|
|
@@ -50,7 +50,7 @@ async function getEndpoint(config) {
|
|
|
50
50
|
* Middleware hook that records the middleware chain
|
|
51
51
|
* when command is in a list of monitored commands.
|
|
52
52
|
*
|
|
53
|
-
* @param {Shim} shim
|
|
53
|
+
* @param {Shim} shim Shim instance
|
|
54
54
|
* @param {Object} config AWS SDK client configuration
|
|
55
55
|
* @param {function} next middleware function
|
|
56
56
|
* @param {Object} context Context for the running command
|
|
@@ -76,7 +76,7 @@ function dynamoMiddleware(shim, config, next, context) {
|
|
|
76
76
|
* Wraps the deserialize middleware step to add the
|
|
77
77
|
* cloud.resource_id segment attributes for the AWS command
|
|
78
78
|
*
|
|
79
|
-
* @param {Shim} shim
|
|
79
|
+
* @param {Shim} shim Shim instance
|
|
80
80
|
* @param {Object} config AWS command configuration
|
|
81
81
|
* @param {function} next next function in middleware chain
|
|
82
82
|
* @returns {function}
|
|
@@ -11,10 +11,10 @@ const InstrumentationDescriptor = require('../../../instrumentation-descriptor')
|
|
|
11
11
|
* Middleware hook that records the middleware chain
|
|
12
12
|
* when command is `PublishCommand`
|
|
13
13
|
*
|
|
14
|
-
* @param {Shim} shim
|
|
15
|
-
* @param config
|
|
14
|
+
* @param {Shim} shim instance
|
|
15
|
+
* @param {Object} config configuration options
|
|
16
16
|
* @param {function} next middleware function
|
|
17
|
-
* @param {Object} context
|
|
17
|
+
* @param {Object} context context
|
|
18
18
|
* @returns {function}
|
|
19
19
|
*/
|
|
20
20
|
function snsMiddleware(shim, config, next, context) {
|
|
@@ -29,9 +29,9 @@ function snsMiddleware(shim, config, next, context) {
|
|
|
29
29
|
/**
|
|
30
30
|
* Returns the spec for PublishCommand
|
|
31
31
|
*
|
|
32
|
-
* @param {Shim} shim
|
|
33
|
-
* @param {
|
|
34
|
-
* @param name
|
|
32
|
+
* @param {Shim} shim instance
|
|
33
|
+
* @param {function} original original middleware function
|
|
34
|
+
* @param {string} name function name
|
|
35
35
|
* @param {Array} args to the middleware function
|
|
36
36
|
* @returns {Object}
|
|
37
37
|
*/
|
|
@@ -50,9 +50,9 @@ function getSnsSpec(shim, original, name, args) {
|
|
|
50
50
|
* Helper to set the appropriate destinationName based on
|
|
51
51
|
* the command input
|
|
52
52
|
*
|
|
53
|
-
* @param
|
|
54
|
-
* @param
|
|
55
|
-
* @param
|
|
53
|
+
* @param {Object} params params object
|
|
54
|
+
* @param {string} params.TopicArn TopicArn if available
|
|
55
|
+
* @param {string} params.TargetArn TargetArn if available
|
|
56
56
|
*/
|
|
57
57
|
function getDestinationName({ TopicArn, TargetArn }) {
|
|
58
58
|
return TopicArn || TargetArn || 'PhoneNumber' // We don't want the value of PhoneNumber
|
|
@@ -17,10 +17,10 @@ const InstrumentationDescriptor = require('../../../instrumentation-descriptor')
|
|
|
17
17
|
* Middleware hook that records the middleware chain
|
|
18
18
|
* when command is `PublishCommand`
|
|
19
19
|
*
|
|
20
|
-
* @param {Shim} shim
|
|
21
|
-
* @param config
|
|
20
|
+
* @param {Shim} shim instance
|
|
21
|
+
* @param {Object} config configuration options
|
|
22
22
|
* @param {function} next middleware function
|
|
23
|
-
* @param {Object} context
|
|
23
|
+
* @param {Object} context context
|
|
24
24
|
* @returns {function}
|
|
25
25
|
*/
|
|
26
26
|
function sqsMiddleware(shim, config, next, context) {
|
|
@@ -37,9 +37,9 @@ function sqsMiddleware(shim, config, next, context) {
|
|
|
37
37
|
/**
|
|
38
38
|
* Returns the spec for PublishCommand
|
|
39
39
|
*
|
|
40
|
-
* @param {Shim} shim
|
|
41
|
-
* @param {
|
|
42
|
-
* @param name
|
|
40
|
+
* @param {Shim} shim instance
|
|
41
|
+
* @param {function} original original middleware function
|
|
42
|
+
* @param {string} name function name
|
|
43
43
|
* @param {Array} args to the middleware function
|
|
44
44
|
* @returns {Object}
|
|
45
45
|
*/
|
|
@@ -289,8 +289,7 @@ function applySegment({ opts, makeRequest, host, port, hostname, segment, config
|
|
|
289
289
|
* events.
|
|
290
290
|
*
|
|
291
291
|
* @param {Agent} agent New Relic agent
|
|
292
|
-
* @param {string}
|
|
293
|
-
* @param host
|
|
292
|
+
* @param {string} host host of outbound request
|
|
294
293
|
* @param {TraceSegment} segment outbound http segment
|
|
295
294
|
* @param {http.IncomingMessage} request actual http outbound request
|
|
296
295
|
*/
|
|
@@ -11,7 +11,7 @@ const { MiddlewareSpec } = require('../../shim/specs')
|
|
|
11
11
|
* Retrieves the IncomingMessage from a Fastify request. Depending on the
|
|
12
12
|
* context of this function it either exists on `request.raw` or just `request`
|
|
13
13
|
*
|
|
14
|
-
* @param {WebFrameworkShim} shim
|
|
14
|
+
* @param {WebFrameworkShim} shim instance
|
|
15
15
|
* @param {Function} fn middleware function executing
|
|
16
16
|
* @param {string} fnName name of middleware executing
|
|
17
17
|
* @param {args} args that are passed to middleware
|
|
@@ -32,7 +32,7 @@ const getRequestFromFastify = (shim, fn, fnName, args) => {
|
|
|
32
32
|
/**
|
|
33
33
|
* Retrieves the params from the Fastify request.
|
|
34
34
|
*
|
|
35
|
-
* @param {WebFrameworkShim} shim
|
|
35
|
+
* @param {WebFrameworkShim} shim instance
|
|
36
36
|
* @param {Function} fn middleware function executing
|
|
37
37
|
* @param {string} fnName name of middleware executing
|
|
38
38
|
* @param {args} args that are passed to middleware
|
|
@@ -52,7 +52,7 @@ const getParamsFromFastifyRequest = (shim, fn, fnName, args) => {
|
|
|
52
52
|
* do its job. You could also think of it as a
|
|
53
53
|
* mini-DSL
|
|
54
54
|
*
|
|
55
|
-
* @param {WebFrameworkShim} shim
|
|
55
|
+
* @param {WebFrameworkShim} shim instance
|
|
56
56
|
* @param {string} path URL route being executed
|
|
57
57
|
* @returns {object} spec for Fastify route handler
|
|
58
58
|
*/
|
|
@@ -78,11 +78,11 @@ function buildMiddlewareSpecForRouteHandler(shim, path) {
|
|
|
78
78
|
* this particular piece of middleware. (i.e. if this is the final handler
|
|
79
79
|
* that is actually handling the request, the path is actually left on)
|
|
80
80
|
*
|
|
81
|
-
* @param shim
|
|
82
|
-
* @param fn
|
|
83
|
-
* @param fnName
|
|
84
|
-
* @param args
|
|
85
|
-
* @param bindSegment
|
|
81
|
+
* @param {WebFrameworkShim} shim instance
|
|
82
|
+
* @param {function} fn function
|
|
83
|
+
* @param {string} fnName function name
|
|
84
|
+
* @param {Array} args arguments
|
|
85
|
+
* @param {function} bindSegment the bindSegment function
|
|
86
86
|
*/
|
|
87
87
|
next: function wrapNext(shim, fn, fnName, args, bindSegment) {
|
|
88
88
|
const reply = args[1]
|
|
@@ -99,11 +99,11 @@ function buildMiddlewareSpecForRouteHandler(shim, path) {
|
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
/**
|
|
102
|
-
* Spec for all Fastify middleware(excluding route handlers)
|
|
102
|
+
* Spec for all Fastify middleware (excluding route handlers)
|
|
103
103
|
*
|
|
104
|
-
* @param {WebFrameworkShim} shim
|
|
104
|
+
* @param {WebFrameworkShim} shim instance
|
|
105
105
|
* @param {string} name metric name for middleware being executed
|
|
106
|
-
* @param route
|
|
106
|
+
* @param {number|string|null} route route
|
|
107
107
|
* @returns {object} spec for Fastify middleware
|
|
108
108
|
*/
|
|
109
109
|
function buildMiddlewareSpecForMiddlewareFunction(shim, name, route) {
|
|
@@ -44,8 +44,8 @@ const REQUEST_HOOKS = [
|
|
|
44
44
|
* at them would require a lot of gymnastics and hard to
|
|
45
45
|
* maintain code
|
|
46
46
|
*
|
|
47
|
-
* @param shim
|
|
48
|
-
* @param fastify
|
|
47
|
+
* @param {WebFrameworkShim} shim instance
|
|
48
|
+
* @param {Object} fastify Fastify instance
|
|
49
49
|
*/
|
|
50
50
|
const setupRouteHandler = (shim, fastify) => {
|
|
51
51
|
fastify.addHook('onRoute', (routeOptions) => {
|
|
@@ -155,8 +155,8 @@ function wrapMiddleware(shim, middleware, name, route) {
|
|
|
155
155
|
* module.exports.fastify = fastify
|
|
156
156
|
* module.exports.default = fastify
|
|
157
157
|
*
|
|
158
|
-
* @param original
|
|
159
|
-
* @param wrappedExport
|
|
158
|
+
* @param {Object} original original exports
|
|
159
|
+
* @param {Object} wrappedExport wrapped exports
|
|
160
160
|
*/
|
|
161
161
|
function setupExports(original, wrappedExport) {
|
|
162
162
|
wrappedExport.fastify = original.fastify
|