newrelic 13.6.5 → 13.7.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 +56 -0
- package/THIRD_PARTY_NOTICES.md +10 -127
- package/index.js +1 -1
- package/lib/agent.js +5 -9
- package/lib/attributes.js +13 -6
- package/lib/config/default.js +19 -71
- package/lib/config/index.js +20 -106
- package/lib/config/samplers.js +251 -0
- package/lib/feature_flags.js +1 -1
- package/lib/instrumentation/koa/router-instrumentation.js +2 -1
- package/lib/otel/logs/index.js +1 -1
- package/lib/otel/metrics/index.js +2 -2
- package/lib/otel/{logs/normalize-timestamp.js → normalize-timestamp.js} +32 -6
- package/lib/otel/setup.js +9 -9
- package/lib/otel/traces/segment-synthesis.js +30 -6
- package/lib/otel/traces/segments/index.js +1 -1
- package/lib/otel/traces/span-processor.js +15 -1
- package/lib/otel/traces/utils.js +3 -1
- package/lib/samplers/README.md +79 -0
- package/lib/samplers/adaptive-sampler.js +27 -3
- package/lib/samplers/always-off-sampler.js +16 -0
- package/lib/samplers/always-on-sampler.js +17 -0
- package/lib/samplers/index.js +270 -0
- package/lib/samplers/ratio-based-sampler.js +74 -0
- package/lib/samplers/sampler.js +58 -0
- package/lib/shimmer.js +2 -2
- package/lib/spans/span-event-aggregator.js +6 -2
- package/lib/spans/span-event.js +145 -45
- package/lib/spans/span-link.js +99 -0
- package/lib/subscribers/express/use.js +72 -21
- package/lib/system-info.js +1 -1
- package/lib/transaction/index.js +13 -109
- package/lib/transaction/trace/index.js +1 -1
- package/lib/transaction/trace/segment.js +6 -9
- package/lib/transaction/tracer/index.js +11 -8
- package/lib/utilization/index.js +46 -17
- package/package.json +1 -5
package/NEWS.md
CHANGED
|
@@ -1,3 +1,58 @@
|
|
|
1
|
+
### v13.7.0 (2025-12-08)
|
|
2
|
+
|
|
3
|
+
#### Features
|
|
4
|
+
|
|
5
|
+
* Updated `koa` instrumentation to properly wrap `Router` when using `@koa/router@15.0.0`+ ([#3550](https://github.com/newrelic/node-newrelic/pull/3550)) ([f1e08ad](https://github.com/newrelic/node-newrelic/commit/f1e08ad9fe200138ab9ed32e423517f64e41af49))
|
|
6
|
+
* Added ability to configure a ratio based sampler ([#3501](https://github.com/newrelic/node-newrelic/pull/3501)) ([f300bd5](https://github.com/newrelic/node-newrelic/commit/f300bd5eacf9d6509b56484e7ad36d5c0725b497))
|
|
7
|
+
* To assign a ratio based sampler, set `config.distributed_tracing.sampler.root`, `config.distributed_tracing.sampler.remote_parent_sampled`, or `config.distributed_tracing.sampler.remote_parent_not_sampled` to `{ trace_id_ratio_based: { ratio: <float between 0 and 1> }}`
|
|
8
|
+
* To assign via environment variables set `NEW_RELIC_DISTRIBUTED_TRACING_SAMPLER_<TYPE>='trace_id_ratio_based'` and `NEW_RELIC_DISTRIBUTED_TRACING_SAMPLER_<TYPE>_RATIO=<float between 0 and 1>` where `<TYPE>` is one of `ROOT`, `REMOTE_PARENT_SAMPLED`, or `REMOTE_PARENT_NOT_SAMPLED`
|
|
9
|
+
* Updated configuration to allow `adaptive.sampling_target` to be set for `config.distributed_tracing.sampler.root`, `config.distributed_tracing.sampler.remote_parent_sampled`, and `config.distributed_tracing.sampler.remote_parent_not_sampled` ([#3532](https://github.com/newrelic/node-newrelic/pull/3532)) ([44f51dd](https://github.com/newrelic/node-newrelic/commit/44f51dd5583e74aef1e2d0ee9483d51d5ff786c3))
|
|
10
|
+
* Added support for OTEL span links ([#3528](https://github.com/newrelic/node-newrelic/pull/3528)) ([e840690](https://github.com/newrelic/node-newrelic/commit/e8406903dd0c92cd003fac69770785489e1bba85))
|
|
11
|
+
* Replaced `default` with `adaptive` as the default for samplers ([#3543](https://github.com/newrelic/node-newrelic/pull/3543)) ([3f03162](https://github.com/newrelic/node-newrelic/commit/3f0316285fdde6d3c38ce819aa41221a71bd4fcb))
|
|
12
|
+
* Preliminary support for partial granularity traces (Not available for production use)
|
|
13
|
+
* Added `essential` type for partial granularity traces ([#3547](https://github.com/newrelic/node-newrelic/pull/3547)) ([3d85fb5](https://github.com/newrelic/node-newrelic/commit/3d85fb5fa16d411892eb4a23067e66669461ada0))
|
|
14
|
+
* Added `reduced` type for partial granularity traces. ([#3540](https://github.com/newrelic/node-newrelic/pull/3540)) ([cfa8f41](https://github.com/newrelic/node-newrelic/commit/cfa8f41618595cc5ffb3e3b5574673721c64580c))
|
|
15
|
+
* Added partial granularity samplers and assign transactions with `isPartialTrace` when partial granularity sampling decisions have been made ([#3544](https://github.com/newrelic/node-newrelic/pull/3544)) ([1535a82](https://github.com/newrelic/node-newrelic/commit/1535a82331ce40d7c96e0c6746ec70bcdbd6e4f6))
|
|
16
|
+
* Refactored samplers into classes and store them on `agent.sampler.*` ([#3527](https://github.com/newrelic/node-newrelic/pull/3527)) ([ad63441](https://github.com/newrelic/node-newrelic/commit/ad634411a0d91240c0c16c7a372b00b36651589f))
|
|
17
|
+
* Updated `Samplers` class to normalize logger messages, short circuit when applicable and remove optional chaining checks ([#3546](https://github.com/newrelic/node-newrelic/pull/3546)) ([4f7684c](https://github.com/newrelic/node-newrelic/commit/4f7684cb4c64a89545704c70c110d2fd13815197))
|
|
18
|
+
* Updated samplers to assign priority between 0-1 when DT is disabled or both full and partial granularity are disabled ([#3559](https://github.com/newrelic/node-newrelic/pull/3559)) ([7a1c37e](https://github.com/newrelic/node-newrelic/commit/7a1c37e3e04fef0538a8af15fa690915bce65262))
|
|
19
|
+
* Updated transaction to store partial granularity indicator as `.partialType` ([#3561](https://github.com/newrelic/node-newrelic/pull/3561)) ([a7f20d8](https://github.com/newrelic/node-newrelic/commit/a7f20d8e83b44556434bae90bd3924c54af9f587))
|
|
20
|
+
* Updated when partial granularity rules are applied ([#3553](https://github.com/newrelic/node-newrelic/pull/3553)) ([a4bdf4f](https://github.com/newrelic/node-newrelic/commit/a4bdf4fbbbdac102519020c5ca4d3dc92eeff844))
|
|
21
|
+
* Added `toString` and `get [Symbol.toStringTag]()` to default Sampler class ([#3562](https://github.com/newrelic/node-newrelic/pull/3562)) ([771168d](https://github.com/newrelic/node-newrelic/commit/771168dcd927240b6efc703f238046e9a7f7766b))
|
|
22
|
+
|
|
23
|
+
#### Bug fixes
|
|
24
|
+
|
|
25
|
+
* Fixed normalization of OTEL hrtime ([#3564](https://github.com/newrelic/node-newrelic/pull/3564)) ([707fe7d](https://github.com/newrelic/node-newrelic/commit/707fe7d6395f0e15b5e6c6195f93df1c27540423))
|
|
26
|
+
|
|
27
|
+
#### Documentation
|
|
28
|
+
|
|
29
|
+
* Updated compatibility report ([#3551](https://github.com/newrelic/node-newrelic/pull/3551)) ([02268a4](https://github.com/newrelic/node-newrelic/commit/02268a4e3fe7b2f2f5c2fd035bcb337fd7b2bfc2))
|
|
30
|
+
* Added internal doc for attributes ([#3539](https://github.com/newrelic/node-newrelic/pull/3539)) ([68543b6](https://github.com/newrelic/node-newrelic/commit/68543b606fc53e59e9a6fcb08173e423bc6437a9))
|
|
31
|
+
|
|
32
|
+
#### Miscellaneous chores
|
|
33
|
+
|
|
34
|
+
* Improved logging around `preconnect` payload
|
|
35
|
+
* Added more logging around assigning hostname during `preconnect` ([#3568](https://github.com/newrelic/node-newrelic/pull/3568)) ([3ee4d38](https://github.com/newrelic/node-newrelic/commit/3ee4d383cd7d9e7bf16e9da5e7f130fc2a103ca4))
|
|
36
|
+
* Improved GCP utilization logging ([#3552](https://github.com/newrelic/node-newrelic/pull/3552)) ([e6c4141](https://github.com/newrelic/node-newrelic/commit/e6c4141b55860b5f1fe5cd14049abb9eca9b3859))
|
|
37
|
+
* Utilization resolution is now done concurrently ([#3556](https://github.com/newrelic/node-newrelic/pull/3556)) ([8386360](https://github.com/newrelic/node-newrelic/commit/8386360fe7fb4b7278e001dac8c8293581654069))
|
|
38
|
+
* Collected OTEL instrumentation scope metadata on all OTEL spans. ([#3554](https://github.com/newrelic/node-newrelic/pull/3554)) ([75703c4](https://github.com/newrelic/node-newrelic/commit/75703c41a8db1d204a1500b8b43dff0d04a5b286))
|
|
39
|
+
* Improved OTEL hrtime processing ([#3557](https://github.com/newrelic/node-newrelic/pull/3557)) ([8f187b1](https://github.com/newrelic/node-newrelic/commit/8f187b11eac96f78d9743cadb2302001ed94412a))
|
|
40
|
+
* Renamed config `opentelemetry_bridge` to `opentelemetry` ([#3565](https://github.com/newrelic/node-newrelic/pull/3565)) ([c9d156f](https://github.com/newrelic/node-newrelic/commit/c9d156fe302ffb99b262ffd3e256d953301f08f2))
|
|
41
|
+
|
|
42
|
+
### v13.6.6 (2025-11-19)
|
|
43
|
+
|
|
44
|
+
#### Bug fixes
|
|
45
|
+
|
|
46
|
+
* Updated `app.use` or `router.use` Express instrumentation to properly wrap all middleware defined ([#3520](https://github.com/newrelic/node-newrelic/pull/3520)) ([d3b20d0](https://github.com/newrelic/node-newrelic/commit/d3b20d09a9c3d21bff081771d8c11caff9c6a6e5))
|
|
47
|
+
|
|
48
|
+
#### Documentation
|
|
49
|
+
|
|
50
|
+
* Updated compatibility report ([#3522](https://github.com/newrelic/node-newrelic/pull/3522)) ([72ec652](https://github.com/newrelic/node-newrelic/commit/72ec65252700ab5f3831dab35d05b607a0723aa6)) ([#3516](https://github.com/newrelic/node-newrelic/pull/3516)) ([35defb0](https://github.com/newrelic/node-newrelic/commit/35defb009b7d3bbec0ffe084b434e368aa1cbc7c))
|
|
51
|
+
|
|
52
|
+
#### Tests
|
|
53
|
+
|
|
54
|
+
* Pinned next.js to skip 11.0.10 and 11.0.11 ([#3521](https://github.com/newrelic/node-newrelic/pull/3521)) ([20977ee](https://github.com/newrelic/node-newrelic/commit/20977eeb8552b7a445f5407d8df272aae49ea873))
|
|
55
|
+
|
|
1
56
|
### v13.6.5 (2025-11-17)
|
|
2
57
|
|
|
3
58
|
#### Bug fixes
|
|
@@ -8064,3 +8119,4 @@ Special thanks to Ryan Copley (@RyanCopley) for the contribution.
|
|
|
8064
8119
|
|
|
8065
8120
|
|
|
8066
8121
|
|
|
8122
|
+
|
package/THIRD_PARTY_NOTICES.md
CHANGED
|
@@ -42,7 +42,6 @@ code, the source code can be found at [https://github.com/newrelic/node-newrelic
|
|
|
42
42
|
|
|
43
43
|
* [@aws-sdk/client-s3](#aws-sdkclient-s3)
|
|
44
44
|
* [@aws-sdk/s3-request-presigner](#aws-sdks3-request-presigner)
|
|
45
|
-
* [@koa/router](#koarouter)
|
|
46
45
|
* [@matteo.collina/tspl](#matteocollinatspl)
|
|
47
46
|
* [@newrelic/eslint-config](#newreliceslint-config)
|
|
48
47
|
* [@newrelic/newrelic-oss-cli](#newrelicnewrelic-oss-cli)
|
|
@@ -69,9 +68,6 @@ code, the source code can be found at [https://github.com/newrelic/node-newrelic
|
|
|
69
68
|
* [got](#got)
|
|
70
69
|
* [husky](#husky)
|
|
71
70
|
* [jsdoc](#jsdoc)
|
|
72
|
-
* [koa-route](#koa-route)
|
|
73
|
-
* [koa-router](#koa-router)
|
|
74
|
-
* [koa](#koa)
|
|
75
71
|
* [lint-staged](#lint-staged)
|
|
76
72
|
* [lockfile-lint](#lockfile-lint)
|
|
77
73
|
* [nock](#nock)
|
|
@@ -1190,7 +1186,7 @@ This product includes source derived from [@opentelemetry/api](https://github.co
|
|
|
1190
1186
|
|
|
1191
1187
|
### @opentelemetry/core
|
|
1192
1188
|
|
|
1193
|
-
This product includes source derived from [@opentelemetry/core](https://github.com/open-telemetry/opentelemetry-js) ([v2.
|
|
1189
|
+
This product includes source derived from [@opentelemetry/core](https://github.com/open-telemetry/opentelemetry-js) ([v2.2.0](https://github.com/open-telemetry/opentelemetry-js/tree/v2.2.0)), distributed under the [Apache-2.0 License](https://github.com/open-telemetry/opentelemetry-js/blob/v2.2.0/LICENSE):
|
|
1194
1190
|
|
|
1195
1191
|
```
|
|
1196
1192
|
Apache License
|
|
@@ -1608,7 +1604,7 @@ This product includes source derived from [@opentelemetry/exporter-metrics-otlp-
|
|
|
1608
1604
|
|
|
1609
1605
|
### @opentelemetry/resources
|
|
1610
1606
|
|
|
1611
|
-
This product includes source derived from [@opentelemetry/resources](https://github.com/open-telemetry/opentelemetry-js) ([v2.
|
|
1607
|
+
This product includes source derived from [@opentelemetry/resources](https://github.com/open-telemetry/opentelemetry-js) ([v2.2.0](https://github.com/open-telemetry/opentelemetry-js/tree/v2.2.0)), distributed under the [Apache-2.0 License](https://github.com/open-telemetry/opentelemetry-js/blob/v2.2.0/LICENSE):
|
|
1612
1608
|
|
|
1613
1609
|
```
|
|
1614
1610
|
Apache License
|
|
@@ -2026,7 +2022,7 @@ This product includes source derived from [@opentelemetry/sdk-logs](https://gith
|
|
|
2026
2022
|
|
|
2027
2023
|
### @opentelemetry/sdk-metrics
|
|
2028
2024
|
|
|
2029
|
-
This product includes source derived from [@opentelemetry/sdk-metrics](https://github.com/open-telemetry/opentelemetry-js) ([v2.
|
|
2025
|
+
This product includes source derived from [@opentelemetry/sdk-metrics](https://github.com/open-telemetry/opentelemetry-js) ([v2.2.0](https://github.com/open-telemetry/opentelemetry-js/tree/v2.2.0)), distributed under the [Apache-2.0 License](https://github.com/open-telemetry/opentelemetry-js/blob/v2.2.0/LICENSE):
|
|
2030
2026
|
|
|
2031
2027
|
```
|
|
2032
2028
|
Apache License
|
|
@@ -2235,7 +2231,7 @@ This product includes source derived from [@opentelemetry/sdk-metrics](https://g
|
|
|
2235
2231
|
|
|
2236
2232
|
### @opentelemetry/sdk-trace-base
|
|
2237
2233
|
|
|
2238
|
-
This product includes source derived from [@opentelemetry/sdk-trace-base](https://github.com/open-telemetry/opentelemetry-js) ([v2.
|
|
2234
|
+
This product includes source derived from [@opentelemetry/sdk-trace-base](https://github.com/open-telemetry/opentelemetry-js) ([v2.2.0](https://github.com/open-telemetry/opentelemetry-js/tree/v2.2.0)), distributed under the [Apache-2.0 License](https://github.com/open-telemetry/opentelemetry-js/blob/v2.2.0/LICENSE):
|
|
2239
2235
|
|
|
2240
2236
|
```
|
|
2241
2237
|
Apache License
|
|
@@ -2533,7 +2529,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
2533
2529
|
|
|
2534
2530
|
### import-in-the-middle
|
|
2535
2531
|
|
|
2536
|
-
This product includes source derived from [import-in-the-middle](https://github.com/nodejs/import-in-the-middle) ([v1.
|
|
2532
|
+
This product includes source derived from [import-in-the-middle](https://github.com/nodejs/import-in-the-middle) ([v1.15.0](https://github.com/nodejs/import-in-the-middle/tree/v1.15.0)), distributed under the [Apache-2.0 License](https://github.com/nodejs/import-in-the-middle/blob/v1.15.0/LICENSE):
|
|
2537
2533
|
|
|
2538
2534
|
```
|
|
2539
2535
|
Apache License
|
|
@@ -2908,7 +2904,7 @@ SOFTWARE.
|
|
|
2908
2904
|
|
|
2909
2905
|
### semver
|
|
2910
2906
|
|
|
2911
|
-
This product includes source derived from [semver](https://github.com/npm/node-semver) ([v7.7.
|
|
2907
|
+
This product includes source derived from [semver](https://github.com/npm/node-semver) ([v7.7.3](https://github.com/npm/node-semver/tree/v7.7.3)), distributed under the [ISC License](https://github.com/npm/node-semver/blob/v7.7.3/LICENSE):
|
|
2912
2908
|
|
|
2913
2909
|
```
|
|
2914
2910
|
The ISC License
|
|
@@ -2964,7 +2960,7 @@ SOFTWARE.
|
|
|
2964
2960
|
|
|
2965
2961
|
### @aws-sdk/client-s3
|
|
2966
2962
|
|
|
2967
|
-
This product includes source derived from [@aws-sdk/client-s3](https://github.com/aws/aws-sdk-js-v3) ([v3.
|
|
2963
|
+
This product includes source derived from [@aws-sdk/client-s3](https://github.com/aws/aws-sdk-js-v3) ([v3.919.0](https://github.com/aws/aws-sdk-js-v3/tree/v3.919.0)), distributed under the [Apache-2.0 License](https://github.com/aws/aws-sdk-js-v3/blob/v3.919.0/LICENSE):
|
|
2968
2964
|
|
|
2969
2965
|
```
|
|
2970
2966
|
Apache License
|
|
@@ -3173,7 +3169,7 @@ This product includes source derived from [@aws-sdk/client-s3](https://github.co
|
|
|
3173
3169
|
|
|
3174
3170
|
### @aws-sdk/s3-request-presigner
|
|
3175
3171
|
|
|
3176
|
-
This product includes source derived from [@aws-sdk/s3-request-presigner](https://github.com/aws/aws-sdk-js-v3) ([v3.
|
|
3172
|
+
This product includes source derived from [@aws-sdk/s3-request-presigner](https://github.com/aws/aws-sdk-js-v3) ([v3.919.0](https://github.com/aws/aws-sdk-js-v3/tree/v3.919.0)), distributed under the [Apache-2.0 License](https://github.com/aws/aws-sdk-js-v3/blob/v3.919.0/LICENSE):
|
|
3177
3173
|
|
|
3178
3174
|
```
|
|
3179
3175
|
Apache License
|
|
@@ -3380,35 +3376,6 @@ This product includes source derived from [@aws-sdk/s3-request-presigner](https:
|
|
|
3380
3376
|
|
|
3381
3377
|
```
|
|
3382
3378
|
|
|
3383
|
-
### @koa/router
|
|
3384
|
-
|
|
3385
|
-
This product includes source derived from [@koa/router](https://github.com/koajs/router) ([v12.0.2](https://github.com/koajs/router/tree/v12.0.2)), distributed under the [MIT License](https://github.com/koajs/router/blob/v12.0.2/LICENSE):
|
|
3386
|
-
|
|
3387
|
-
```
|
|
3388
|
-
The MIT License (MIT)
|
|
3389
|
-
|
|
3390
|
-
Copyright (c) 2015 Alexander C. Mingoia and @koajs contributors
|
|
3391
|
-
|
|
3392
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
3393
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
3394
|
-
in the Software without restriction, including without limitation the rights
|
|
3395
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
3396
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
3397
|
-
furnished to do so, subject to the following conditions:
|
|
3398
|
-
|
|
3399
|
-
The above copyright notice and this permission notice shall be included in
|
|
3400
|
-
all copies or substantial portions of the Software.
|
|
3401
|
-
|
|
3402
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
3403
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
3404
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
3405
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
3406
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
3407
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
3408
|
-
THE SOFTWARE.
|
|
3409
|
-
|
|
3410
|
-
```
|
|
3411
|
-
|
|
3412
3379
|
### @matteo.collina/tspl
|
|
3413
3380
|
|
|
3414
3381
|
This product includes source derived from [@matteo.collina/tspl](https://github.com/mcollina/tspl) ([v0.1.1](https://github.com/mcollina/tspl/tree/v0.1.1)), distributed under the [MIT License](https://github.com/mcollina/tspl/blob/v0.1.1/LICENSE):
|
|
@@ -5033,7 +5000,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
5033
5000
|
|
|
5034
5001
|
### eslint
|
|
5035
5002
|
|
|
5036
|
-
This product includes source derived from [eslint](https://github.com/eslint/eslint) ([v9.
|
|
5003
|
+
This product includes source derived from [eslint](https://github.com/eslint/eslint) ([v9.38.0](https://github.com/eslint/eslint/tree/v9.38.0)), distributed under the [MIT License](https://github.com/eslint/eslint/blob/v9.38.0/LICENSE):
|
|
5037
5004
|
|
|
5038
5005
|
```
|
|
5039
5006
|
Copyright OpenJS Foundation and other contributors, <www.openjsf.org>
|
|
@@ -5196,7 +5163,7 @@ SOFTWARE.
|
|
|
5196
5163
|
|
|
5197
5164
|
### jsdoc
|
|
5198
5165
|
|
|
5199
|
-
This product includes source derived from [jsdoc](https://github.com/jsdoc/jsdoc) ([v4.0.
|
|
5166
|
+
This product includes source derived from [jsdoc](https://github.com/jsdoc/jsdoc) ([v4.0.5](https://github.com/jsdoc/jsdoc/tree/v4.0.5)), distributed under the [Apache-2.0 License](https://github.com/jsdoc/jsdoc/blob/v4.0.5/LICENSE.md):
|
|
5200
5167
|
|
|
5201
5168
|
```
|
|
5202
5169
|
# License
|
|
@@ -5304,90 +5271,6 @@ https://github.com/jmblog/color-themes-for-google-code-prettify
|
|
|
5304
5271
|
|
|
5305
5272
|
```
|
|
5306
5273
|
|
|
5307
|
-
### koa-route
|
|
5308
|
-
|
|
5309
|
-
This product includes source derived from [koa-route](https://github.com/koajs/route) ([v4.0.1](https://github.com/koajs/route/tree/v4.0.1)), distributed under the [MIT License](https://github.com/koajs/route/blob/v4.0.1/Readme.md):
|
|
5310
|
-
|
|
5311
|
-
```
|
|
5312
|
-
MIT License
|
|
5313
|
-
|
|
5314
|
-
Copyright (c) <year> <copyright holders>
|
|
5315
|
-
|
|
5316
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
|
5317
|
-
associated documentation files (the "Software"), to deal in the Software without restriction, including
|
|
5318
|
-
without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
5319
|
-
copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
|
|
5320
|
-
following conditions:
|
|
5321
|
-
|
|
5322
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial
|
|
5323
|
-
portions of the Software.
|
|
5324
|
-
|
|
5325
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
|
5326
|
-
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
|
|
5327
|
-
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
5328
|
-
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
5329
|
-
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
5330
|
-
```
|
|
5331
|
-
|
|
5332
|
-
### koa-router
|
|
5333
|
-
|
|
5334
|
-
This product includes source derived from [koa-router](https://github.com/koajs/router) ([v12.0.1](https://github.com/koajs/router/tree/v12.0.1)), distributed under the [MIT License](https://github.com/koajs/router/blob/v12.0.1/LICENSE):
|
|
5335
|
-
|
|
5336
|
-
```
|
|
5337
|
-
The MIT License (MIT)
|
|
5338
|
-
|
|
5339
|
-
Copyright (c) 2015 Alexander C. Mingoia and @koajs contributors
|
|
5340
|
-
|
|
5341
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5342
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
5343
|
-
in the Software without restriction, including without limitation the rights
|
|
5344
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
5345
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
5346
|
-
furnished to do so, subject to the following conditions:
|
|
5347
|
-
|
|
5348
|
-
The above copyright notice and this permission notice shall be included in
|
|
5349
|
-
all copies or substantial portions of the Software.
|
|
5350
|
-
|
|
5351
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
5352
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
5353
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
5354
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
5355
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
5356
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
5357
|
-
THE SOFTWARE.
|
|
5358
|
-
|
|
5359
|
-
```
|
|
5360
|
-
|
|
5361
|
-
### koa
|
|
5362
|
-
|
|
5363
|
-
This product includes source derived from [koa](https://github.com/koajs/koa) ([v2.16.2](https://github.com/koajs/koa/tree/v2.16.2)), distributed under the [MIT License](https://github.com/koajs/koa/blob/v2.16.2/LICENSE):
|
|
5364
|
-
|
|
5365
|
-
```
|
|
5366
|
-
(The MIT License)
|
|
5367
|
-
|
|
5368
|
-
Copyright (c) 2019 Koa contributors
|
|
5369
|
-
|
|
5370
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
5371
|
-
a copy of this software and associated documentation files (the
|
|
5372
|
-
'Software'), to deal in the Software without restriction, including
|
|
5373
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
|
5374
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
|
5375
|
-
permit persons to whom the Software is furnished to do so, subject to
|
|
5376
|
-
the following conditions:
|
|
5377
|
-
|
|
5378
|
-
The above copyright notice and this permission notice shall be
|
|
5379
|
-
included in all copies or substantial portions of the Software.
|
|
5380
|
-
|
|
5381
|
-
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
5382
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
5383
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
5384
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
5385
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
5386
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
5387
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
5388
|
-
|
|
5389
|
-
```
|
|
5390
|
-
|
|
5391
5274
|
### lint-staged
|
|
5392
5275
|
|
|
5393
5276
|
This product includes source derived from [lint-staged](https://github.com/okonet/lint-staged) ([v11.2.6](https://github.com/okonet/lint-staged/tree/v11.2.6)), distributed under the [MIT License](https://github.com/okonet/lint-staged/blob/v11.2.6/LICENSE):
|
package/index.js
CHANGED
|
@@ -102,7 +102,7 @@ function initialize() {
|
|
|
102
102
|
logger.warn(
|
|
103
103
|
'New Relic for Node.js in worker_threads is not officially supported. Not starting! To bypass this, set `config.worker_threads.enabled` to true in configuration.'
|
|
104
104
|
)
|
|
105
|
-
} else if (config.
|
|
105
|
+
} else if (config.opentelemetry.enabled === true && otelBridgeAvailable() === false) {
|
|
106
106
|
logger.warn(
|
|
107
107
|
'OpenTelemetry bridge enabled, but packages are missing. Not starting!'
|
|
108
108
|
)
|
package/lib/agent.js
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
|
|
6
6
|
'use strict'
|
|
7
7
|
|
|
8
|
-
const AdaptiveSampler = require('./samplers/adaptive-sampler')
|
|
9
8
|
const CollectorAPI = require('./collector/api')
|
|
10
9
|
const ServerlessCollector = require('./collector/serverless')
|
|
11
10
|
const DESTINATIONS = require('./config/attribute-filter').DESTINATIONS
|
|
@@ -41,6 +40,7 @@ const synthetics = require('./synthetics')
|
|
|
41
40
|
const Harvester = require('./harvester')
|
|
42
41
|
const { createFeatureUsageMetrics } = require('./util/application-logging')
|
|
43
42
|
const HealthReporter = require('./health-reporter')
|
|
43
|
+
const Samplers = require('./samplers')
|
|
44
44
|
|
|
45
45
|
// Map of valid states to whether or not data collection is valid
|
|
46
46
|
const STATES = {
|
|
@@ -287,12 +287,8 @@ function Agent(config) {
|
|
|
287
287
|
this.collector,
|
|
288
288
|
this.harvester
|
|
289
289
|
)
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
serverless: config.serverless_mode.enabled,
|
|
293
|
-
period: config.sampling_target_period_in_seconds * 1000,
|
|
294
|
-
target: config.sampling_target
|
|
295
|
-
})
|
|
290
|
+
|
|
291
|
+
this.samplers = new Samplers(this)
|
|
296
292
|
|
|
297
293
|
this.queries = new QueryTraceAggregator(
|
|
298
294
|
{
|
|
@@ -848,10 +844,10 @@ Agent.prototype._listenForConfigChanges = function _listenForConfigChanges() {
|
|
|
848
844
|
self.txSegmentNormalizer.load.apply(self.txSegmentNormalizer, arguments)
|
|
849
845
|
})
|
|
850
846
|
this.config.on('sampling_target', function updateSamplingTarget(target) {
|
|
851
|
-
self.
|
|
847
|
+
self.samplers.updateAdaptiveTarget(target)
|
|
852
848
|
})
|
|
853
849
|
this.config.on('sampling_target_period_in_seconds', function updateSamplePeriod(period) {
|
|
854
|
-
self.
|
|
850
|
+
self.samplers.updateAdaptivePeriod(period)
|
|
855
851
|
})
|
|
856
852
|
this.config.on('event_harvest_config', function onHarvestConfigReceived(harvestConfig) {
|
|
857
853
|
if (harvestConfig) {
|
package/lib/attributes.js
CHANGED
|
@@ -19,6 +19,9 @@ const MAXIMUM_ATTR_VALUE_LENGTH = 4_096
|
|
|
19
19
|
* @private
|
|
20
20
|
*/
|
|
21
21
|
class Attributes {
|
|
22
|
+
static SCOPE_TRANSACTION = 'transaction'
|
|
23
|
+
static SCOPE_SEGMENT = 'segment'
|
|
24
|
+
|
|
22
25
|
/**
|
|
23
26
|
* @param {object} params Constructor parameters.
|
|
24
27
|
* @param {string} params.scope
|
|
@@ -125,8 +128,8 @@ class Attributes {
|
|
|
125
128
|
|
|
126
129
|
if (!isValidType(value)) {
|
|
127
130
|
return logger.debug(
|
|
128
|
-
'Not adding attribute %s with %s value type. This is expected for undefined' +
|
|
129
|
-
'attributes and only an issue if an attribute is not expected to be undefined' +
|
|
131
|
+
'Not adding attribute %s with %s value type. This is expected for undefined ' +
|
|
132
|
+
'attributes and only an issue if an attribute is not expected to be undefined ' +
|
|
130
133
|
'or not of the type expected.',
|
|
131
134
|
key,
|
|
132
135
|
typeof value
|
|
@@ -181,10 +184,14 @@ class Attributes {
|
|
|
181
184
|
*/
|
|
182
185
|
function makeFilter(scope) {
|
|
183
186
|
const { attributeFilter } = Config.getInstance()
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
187
|
+
switch (scope) {
|
|
188
|
+
case Attributes.SCOPE_TRANSACTION: {
|
|
189
|
+
return (d, k) => attributeFilter.filterTransaction(d, k)
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
case Attributes.SCOPE_SEGMENT: {
|
|
193
|
+
return (d, k) => attributeFilter.filterSegment(d, k)
|
|
194
|
+
}
|
|
188
195
|
}
|
|
189
196
|
}
|
|
190
197
|
|
package/lib/config/default.js
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
const defaultConfig = module.exports
|
|
9
9
|
const { array, int, float, boolean, object, objectList, allowList, regex } = require('./formatters')
|
|
10
10
|
const pkgInstrumentation = require('./build-instrumentation-config')
|
|
11
|
+
const { config: samplerConfigs } = require('./samplers')
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* A function that returns the definition of the agent configuration
|
|
@@ -1156,6 +1157,7 @@ defaultConfig.definition = () => {
|
|
|
1156
1157
|
},
|
|
1157
1158
|
|
|
1158
1159
|
sampler: {
|
|
1160
|
+
...samplerConfigs,
|
|
1159
1161
|
/**
|
|
1160
1162
|
* The sampling target for adaptive sampling is controlled via this attribute when configuring the default/adaptive sampler.
|
|
1161
1163
|
* The default sampling target is 10 transactions/min when it is not specified but **MUST** be within the range of [1, 120] (inclusive).
|
|
@@ -1166,77 +1168,22 @@ defaultConfig.definition = () => {
|
|
|
1166
1168
|
formatter: int,
|
|
1167
1169
|
default: 10
|
|
1168
1170
|
},
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
// root: 'always_on'
|
|
1175
|
-
//
|
|
1176
|
-
// Example setting root sampler via config to trace id ratio based -
|
|
1177
|
-
// root: {
|
|
1178
|
-
// trace_id_ratio_based: {
|
|
1179
|
-
// ratio: 0.5
|
|
1180
|
-
// }
|
|
1181
|
-
// }
|
|
1182
|
-
//
|
|
1183
|
-
root: {
|
|
1184
|
-
formatter: allowList.bind(null, ['trace_id_ratio_based', 'adaptive', 'always_on', 'always_off', 'default']),
|
|
1185
|
-
default: 'default',
|
|
1186
|
-
// if setting root to trace_id_ratio_based via env vars, set NEW_RELIC_DISTRIBUTED_TRACING_SAMPLER_ROOT: 'trace_id_ratio_based'
|
|
1187
|
-
// and then set NEW_RELIC_DISTRIBUTED_TRACING_SAMPLER_ROOT_TRACE_ID_RATIO_BASED_RATIO to the desired ratio
|
|
1188
|
-
trace_id_ratio_based: {
|
|
1189
|
-
ratio: {
|
|
1190
|
-
formatter: float,
|
|
1191
|
-
env: 'NEW_RELIC_DISTRIBUTED_TRACING_SAMPLER_ROOT_TRACE_ID_RATIO_BASED_RATIO'
|
|
1192
|
-
}
|
|
1193
|
-
}
|
|
1194
|
-
},
|
|
1195
|
-
|
|
1196
|
-
/**
|
|
1197
|
-
* When set to `always_on`, the sampled flag in the `traceparent` header
|
|
1198
|
-
* being set to "true" will result in the local transaction being sampled
|
|
1199
|
-
* with a priority value of "2". When set to `always_off`, the local
|
|
1200
|
-
* transaction will never be sampled. At the default setting, the sampling
|
|
1201
|
-
* decision will be determined according to the normal algorithm.
|
|
1202
|
-
*
|
|
1203
|
-
* This setting takes precedence over the `remote_parent_not_sampled`
|
|
1204
|
-
* setting.
|
|
1205
|
-
*/
|
|
1206
|
-
remote_parent_sampled: {
|
|
1207
|
-
formatter: allowList.bind(null, ['trace_id_ratio_based', 'adaptive', 'always_on', 'always_off', 'default']),
|
|
1208
|
-
default: 'default',
|
|
1209
|
-
// if setting remote_parent_sampled to trace_id_ratio_based via env vars, set NEW_RELIC_DISTRIBUTED_TRACING_SAMPLER_REMOTE_PARENT_SAMPLED: 'trace_id_ratio_based'
|
|
1210
|
-
// and then set NEW_RELIC_DISTRIBUTED_TRACING_SAMPLER_REMOTE_PARENT_SAMPLED_TRACE_ID_RATIO_BASED_RATIO to the desired ratio
|
|
1211
|
-
trace_id_ratio_based: {
|
|
1212
|
-
ratio: {
|
|
1213
|
-
formatter: float,
|
|
1214
|
-
env: 'NEW_RELIC_DISTRIBUTED_TRACING_SAMPLER_REMOTE_PARENT_SAMPLED_TRACE_ID_RATIO_BASED_RATIO'
|
|
1215
|
-
}
|
|
1216
|
-
}
|
|
1171
|
+
full_granularity: {
|
|
1172
|
+
enabled: {
|
|
1173
|
+
default: true,
|
|
1174
|
+
formatter: boolean
|
|
1175
|
+
},
|
|
1217
1176
|
},
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
*/
|
|
1229
|
-
remote_parent_not_sampled: {
|
|
1230
|
-
formatter: allowList.bind(null, ['trace_id_ratio_based', 'adaptive', 'always_on', 'always_off', 'default']),
|
|
1231
|
-
default: 'default',
|
|
1232
|
-
// if setting remote_parent_not_sampled to trace_id_ratio_based via env vars, set NEW_RELIC_DISTRIBUTED_TRACING_SAMPLER_REMOTE_PARENT_NOT_SAMPLED: 'trace_id_ratio_based'
|
|
1233
|
-
// and then set NEW_RELIC_DISTRIBUTED_TRACING_SAMPLER_REMOTE_PARENT_NOT_SAMPLED_TRACE_ID_RATIO_BASED_RATIO to the desired ratio
|
|
1234
|
-
trace_id_ratio_based: {
|
|
1235
|
-
ratio: {
|
|
1236
|
-
formatter: float,
|
|
1237
|
-
env: 'NEW_RELIC_DISTRIBUTED_TRACING_SAMPLER_REMOTE_PARENT_NOT_SAMPLED_TRACE_ID_RATIO_BASED_RATIO'
|
|
1238
|
-
}
|
|
1239
|
-
}
|
|
1177
|
+
partial_granularity: {
|
|
1178
|
+
enabled: {
|
|
1179
|
+
default: false,
|
|
1180
|
+
formatter: boolean
|
|
1181
|
+
},
|
|
1182
|
+
type: {
|
|
1183
|
+
formatter: allowList.bind(null, ['compact', 'essential', 'reduced']),
|
|
1184
|
+
default: 'essential'
|
|
1185
|
+
},
|
|
1186
|
+
...samplerConfigs
|
|
1240
1187
|
}
|
|
1241
1188
|
}
|
|
1242
1189
|
},
|
|
@@ -1759,7 +1706,7 @@ defaultConfig.definition = () => {
|
|
|
1759
1706
|
* NOTICE: this configuration is subject to change while the OTEL
|
|
1760
1707
|
* feature set is in development.
|
|
1761
1708
|
*/
|
|
1762
|
-
|
|
1709
|
+
opentelemetry: {
|
|
1763
1710
|
/**
|
|
1764
1711
|
* Global switch for the whole OpenTelemetry feature. If it is set to
|
|
1765
1712
|
* `false`, any other sub-feature, e.g. `traces`, will not be enabled
|
|
@@ -1909,4 +1856,5 @@ function setNestedKey(obj, keys, value) {
|
|
|
1909
1856
|
|
|
1910
1857
|
obj[keys[len - 1]] = value
|
|
1911
1858
|
}
|
|
1859
|
+
|
|
1912
1860
|
defaultConfig.setNestedKey = setNestedKey
|