newrelic 9.7.0 → 9.7.1

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 (36) hide show
  1. package/NEWS.md +40 -20
  2. package/THIRD_PARTY_NOTICES.md +203 -2
  3. package/api.js +155 -103
  4. package/lib/agent.js +29 -82
  5. package/lib/collector/api.js +234 -201
  6. package/lib/config/attribute-filter.js +35 -25
  7. package/lib/config/default.js +45 -19
  8. package/lib/config/index.js +260 -199
  9. package/lib/environment.js +16 -12
  10. package/lib/errors/error-collector.js +124 -55
  11. package/lib/errors/index.js +59 -49
  12. package/lib/instrumentation/@hapi/hapi.js +56 -50
  13. package/lib/instrumentation/@node-redis/client.js +50 -41
  14. package/lib/instrumentation/amqplib.js +116 -151
  15. package/lib/instrumentation/core/{async_hooks.js → async-hooks.js} +26 -11
  16. package/lib/instrumentation/core/globals.js +1 -1
  17. package/lib/instrumentation/core/http-outbound.js +193 -78
  18. package/lib/instrumentation/core/timers.js +106 -59
  19. package/lib/instrumentation/mongodb/common.js +87 -85
  20. package/lib/instrumentation/redis.js +112 -90
  21. package/lib/instrumentation/undici.js +204 -192
  22. package/lib/instrumentation/{when.js → when/constants.js} +13 -10
  23. package/lib/instrumentation/when/contextualizer.js +168 -0
  24. package/lib/instrumentation/when/index.js +354 -0
  25. package/lib/instrumentation/when/nr-hooks.js +15 -0
  26. package/lib/instrumentations.js +1 -1
  27. package/lib/shim/shim.js +2 -0
  28. package/lib/shim/webframework-shim.js +19 -0
  29. package/lib/symbols.js +1 -0
  30. package/lib/system-info.js +240 -163
  31. package/lib/util/async-each-limit.js +30 -0
  32. package/lib/util/attributes.js +159 -0
  33. package/lib/util/code-level-metrics.js +58 -0
  34. package/lib/util/deep-equal.js +11 -144
  35. package/package.json +5 -4
  36. package/lib/instrumentation/promise.js +0 -572
package/NEWS.md CHANGED
@@ -1,25 +1,45 @@
1
- ### v9.7.0 (2022-11-14)
2
-
3
- * Added new configuration option, `grpc.ignore_status_codes`, which can be used to select nonzero gRPC status codes to ignore and not report as errors.
4
-
5
- ### v9.6.0 (2022-11-09)
6
-
7
- * Dropped support for `vision`, and instead only instrument `@hapi/vision`.
8
-
1
+ ### v9.7.1 (2022-12-06)
2
+
3
+ * Reintroduced throttling during reading of instrumented application's dependency tree during startup, to prevent EMFILE issues.
4
+
5
+ * Improved Restify support
6
+ * Added a new test stanza to run restify >=10 on Node 18.
7
+ * Update our versioned tests to support Restify 9.0.0.
8
+
9
+ * Laid foundation for supporting Code Level Metrics via [Codestream](https://docs.newrelic.com/docs/codestream/how-use-codestream/performance-monitoring/). Note that this integration is not fully finished and should not be used.
10
+
11
+ * Improved the readability and maintainability of agent by reducing the [Cognitive Complexity](https://www.sonarsource.com/resources/cognitive-complexity/) of various aspects of the agent.
12
+
13
+ * Added `newrelic.noticeError()` example to our API docs.
14
+
15
+ * Upgraded @grpc/grpc-js from 1.6.9 to 1.7.3.
16
+
17
+ * Upgraded @grpc/proto-loader from 0.6.13 to 0.7.3.
18
+
19
+ * Removed async from benchmark tests, fixed failing benchmark suites, and removed deprecated suite.
20
+
21
+ ### v9.7.0 (2022-11-14)
22
+
23
+ * Added new configuration option, `grpc.ignore_status_codes`, which can be used to select nonzero gRPC status codes to ignore and not report as errors.
24
+
25
+ ### v9.6.0 (2022-11-09)
26
+
27
+ * Dropped support for `vision`, and instead only instrument `@hapi/vision`.
28
+
9
29
  * Updated configuration system to automatically create an environment variable mapping for a new config value.
10
30
  * It will follow a convention of `NEW_RELIC_PATH_TO_CONFIG_KEY`.
11
- * For example if there is a new configuration option of `config.nested.object_path.enabled` the env var would be `NEW_RELIC_NESTED_OBJECT_PATH.ENABLED`.
12
-
13
- * Removed `transaction_tracer.hide_internals` configuration. All of the internal configuration is now handled by Javascript symbols instead of non-enumerable properties, so there is no longer a performance penalty, as symbols are already hidden by default.
14
-
15
- ### v9.5.0 (2022-10-26)
16
-
17
- * Increased the default limit of custom events from 1,000 events per minute to 3,000 events per minute. In the scenario that custom events were being limited, this change will allow more custom events to be sent to New Relic. There is also a new configurable maximum limit of 100,000 events per minute. To change the limits, see the documentation for [custom_insights_events](https://docs.newrelic.com/docs/apm/agents/nodejs-agent/installation-configuration/nodejs-agent-configuration#custom_events_max_samples_stored). To learn more about the change and how to determine if custom events are being dropped, see our Explorers Hub [post](https://discuss.newrelic.com/t/send-more-custom-events-with-the-latest-apm-agents/190497).
18
-
19
- * Updated CI process to include collection of code coverage statistics.
20
-
21
- * Added a [document](./documentation/feature-flags.md) for our current feature flags.
22
-
31
+ * For example if there is a new configuration option of `config.nested.object_path.enabled` the env var would be `NEW_RELIC_NESTED_OBJECT_PATH.ENABLED`.
32
+
33
+ * Removed `transaction_tracer.hide_internals` configuration. All of the internal configuration is now handled by Javascript symbols instead of non-enumerable properties, so there is no longer a performance penalty, as symbols are already hidden by default.
34
+
35
+ ### v9.5.0 (2022-10-26)
36
+
37
+ * Increased the default limit of custom events from 1,000 events per minute to 3,000 events per minute. In the scenario that custom events were being limited, this change will allow more custom events to be sent to New Relic. There is also a new configurable maximum limit of 100,000 events per minute. To change the limits, see the documentation for [custom_insights_events](https://docs.newrelic.com/docs/apm/agents/nodejs-agent/installation-configuration/nodejs-agent-configuration#custom_events_max_samples_stored). To learn more about the change and how to determine if custom events are being dropped, see our Explorers Hub [post](https://discuss.newrelic.com/t/send-more-custom-events-with-the-latest-apm-agents/190497).
38
+
39
+ * Updated CI process to include collection of code coverage statistics.
40
+
41
+ * Added a [document](./documentation/feature-flags.md) for our current feature flags.
42
+
23
43
  ### v9.4.0 (2022-10-24)
24
44
 
25
45
  * Removed legacy agent async context propagation. The default behavior is now what was behind the `feature_flag.new_promise_tracking`. You can read more about the difference [here](https://docs.newrelic.com/docs/release-notes/agent-release-notes/nodejs-release-notes/node-agent-7-3-0#new-features).
@@ -46,6 +46,7 @@ code, the source code can be found at [https://github.com/newrelic/node-newrelic
46
46
  * [eslint-plugin-jsdoc](#eslint-plugin-jsdoc)
47
47
  * [eslint-plugin-node](#eslint-plugin-node)
48
48
  * [eslint-plugin-prettier](#eslint-plugin-prettier)
49
+ * [eslint-plugin-sonarjs](#eslint-plugin-sonarjs)
49
50
  * [eslint](#eslint)
50
51
  * [express](#express)
51
52
  * [glob](#glob)
@@ -70,6 +71,7 @@ code, the source code can be found at [https://github.com/newrelic/node-newrelic
70
71
 
71
72
  **[optionalDependencies](#optionalDependencies)**
72
73
 
74
+ * [@contrast/fn-inspect](#contrastfn-inspect)
73
75
  * [@newrelic/native-metrics](#newrelicnative-metrics)
74
76
 
75
77
  **[Additional Licenses](#additional-licenses)**
@@ -81,7 +83,7 @@ code, the source code can be found at [https://github.com/newrelic/node-newrelic
81
83
 
82
84
  ### @grpc/grpc-js
83
85
 
84
- This product includes source derived from [@grpc/grpc-js](https://github.com/grpc/grpc-node/tree/master/packages/grpc-js) ([v1.6.9](https://github.com/grpc/grpc-node/tree/master/packages/grpc-js/tree/v1.6.9)), distributed under the [Apache-2.0 License](https://github.com/grpc/grpc-node/tree/master/packages/grpc-js/blob/v1.6.9/LICENSE):
86
+ This product includes source derived from [@grpc/grpc-js](https://github.com/grpc/grpc-node/tree/master/packages/grpc-js) ([v1.7.3](https://github.com/grpc/grpc-node/tree/master/packages/grpc-js/tree/v1.7.3)), distributed under the [Apache-2.0 License](https://github.com/grpc/grpc-node/tree/master/packages/grpc-js/blob/v1.7.3/LICENSE):
85
87
 
86
88
  ```
87
89
  Apache License
@@ -290,7 +292,7 @@ This product includes source derived from [@grpc/grpc-js](https://github.com/grp
290
292
 
291
293
  ### @grpc/proto-loader
292
294
 
293
- This product includes source derived from [@grpc/proto-loader](https://github.com/grpc/grpc-node) ([v0.6.13](https://github.com/grpc/grpc-node/tree/v0.6.13)), distributed under the [Apache-2.0 License](https://github.com/grpc/grpc-node/blob/v0.6.13/LICENSE):
295
+ This product includes source derived from [@grpc/proto-loader](https://github.com/grpc/grpc-node) ([v0.7.3](https://github.com/grpc/grpc-node/tree/v0.7.3)), distributed under the [Apache-2.0 License](https://github.com/grpc/grpc-node/blob/v0.7.3/LICENSE):
294
296
 
295
297
  ```
296
298
  Apache License
@@ -2339,6 +2341,179 @@ OTHER DEALINGS IN THE SOFTWARE.
2339
2341
 
2340
2342
  ```
2341
2343
 
2344
+ ### eslint-plugin-sonarjs
2345
+
2346
+ This product includes source derived from [eslint-plugin-sonarjs](https://github.com/SonarSource/eslint-plugin-sonarjs) ([v0.15.0](https://github.com/SonarSource/eslint-plugin-sonarjs/tree/v0.15.0)), distributed under the [LGPL-3.0 License](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/v0.15.0/LICENSE):
2347
+
2348
+ ```
2349
+ GNU LESSER GENERAL PUBLIC LICENSE
2350
+ Version 3, 29 June 2007
2351
+
2352
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
2353
+ Everyone is permitted to copy and distribute verbatim copies
2354
+ of this license document, but changing it is not allowed.
2355
+
2356
+
2357
+ This version of the GNU Lesser General Public License incorporates
2358
+ the terms and conditions of version 3 of the GNU General Public
2359
+ License, supplemented by the additional permissions listed below.
2360
+
2361
+ 0. Additional Definitions.
2362
+
2363
+ As used herein, "this License" refers to version 3 of the GNU Lesser
2364
+ General Public License, and the "GNU GPL" refers to version 3 of the GNU
2365
+ General Public License.
2366
+
2367
+ "The Library" refers to a covered work governed by this License,
2368
+ other than an Application or a Combined Work as defined below.
2369
+
2370
+ An "Application" is any work that makes use of an interface provided
2371
+ by the Library, but which is not otherwise based on the Library.
2372
+ Defining a subclass of a class defined by the Library is deemed a mode
2373
+ of using an interface provided by the Library.
2374
+
2375
+ A "Combined Work" is a work produced by combining or linking an
2376
+ Application with the Library. The particular version of the Library
2377
+ with which the Combined Work was made is also called the "Linked
2378
+ Version".
2379
+
2380
+ The "Minimal Corresponding Source" for a Combined Work means the
2381
+ Corresponding Source for the Combined Work, excluding any source code
2382
+ for portions of the Combined Work that, considered in isolation, are
2383
+ based on the Application, and not on the Linked Version.
2384
+
2385
+ The "Corresponding Application Code" for a Combined Work means the
2386
+ object code and/or source code for the Application, including any data
2387
+ and utility programs needed for reproducing the Combined Work from the
2388
+ Application, but excluding the System Libraries of the Combined Work.
2389
+
2390
+ 1. Exception to Section 3 of the GNU GPL.
2391
+
2392
+ You may convey a covered work under sections 3 and 4 of this License
2393
+ without being bound by section 3 of the GNU GPL.
2394
+
2395
+ 2. Conveying Modified Versions.
2396
+
2397
+ If you modify a copy of the Library, and, in your modifications, a
2398
+ facility refers to a function or data to be supplied by an Application
2399
+ that uses the facility (other than as an argument passed when the
2400
+ facility is invoked), then you may convey a copy of the modified
2401
+ version:
2402
+
2403
+ a) under this License, provided that you make a good faith effort to
2404
+ ensure that, in the event an Application does not supply the
2405
+ function or data, the facility still operates, and performs
2406
+ whatever part of its purpose remains meaningful, or
2407
+
2408
+ b) under the GNU GPL, with none of the additional permissions of
2409
+ this License applicable to that copy.
2410
+
2411
+ 3. Object Code Incorporating Material from Library Header Files.
2412
+
2413
+ The object code form of an Application may incorporate material from
2414
+ a header file that is part of the Library. You may convey such object
2415
+ code under terms of your choice, provided that, if the incorporated
2416
+ material is not limited to numerical parameters, data structure
2417
+ layouts and accessors, or small macros, inline functions and templates
2418
+ (ten or fewer lines in length), you do both of the following:
2419
+
2420
+ a) Give prominent notice with each copy of the object code that the
2421
+ Library is used in it and that the Library and its use are
2422
+ covered by this License.
2423
+
2424
+ b) Accompany the object code with a copy of the GNU GPL and this license
2425
+ document.
2426
+
2427
+ 4. Combined Works.
2428
+
2429
+ You may convey a Combined Work under terms of your choice that,
2430
+ taken together, effectively do not restrict modification of the
2431
+ portions of the Library contained in the Combined Work and reverse
2432
+ engineering for debugging such modifications, if you also do each of
2433
+ the following:
2434
+
2435
+ a) Give prominent notice with each copy of the Combined Work that
2436
+ the Library is used in it and that the Library and its use are
2437
+ covered by this License.
2438
+
2439
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
2440
+ document.
2441
+
2442
+ c) For a Combined Work that displays copyright notices during
2443
+ execution, include the copyright notice for the Library among
2444
+ these notices, as well as a reference directing the user to the
2445
+ copies of the GNU GPL and this license document.
2446
+
2447
+ d) Do one of the following:
2448
+
2449
+ 0) Convey the Minimal Corresponding Source under the terms of this
2450
+ License, and the Corresponding Application Code in a form
2451
+ suitable for, and under terms that permit, the user to
2452
+ recombine or relink the Application with a modified version of
2453
+ the Linked Version to produce a modified Combined Work, in the
2454
+ manner specified by section 6 of the GNU GPL for conveying
2455
+ Corresponding Source.
2456
+
2457
+ 1) Use a suitable shared library mechanism for linking with the
2458
+ Library. A suitable mechanism is one that (a) uses at run time
2459
+ a copy of the Library already present on the user's computer
2460
+ system, and (b) will operate properly with a modified version
2461
+ of the Library that is interface-compatible with the Linked
2462
+ Version.
2463
+
2464
+ e) Provide Installation Information, but only if you would otherwise
2465
+ be required to provide such information under section 6 of the
2466
+ GNU GPL, and only to the extent that such information is
2467
+ necessary to install and execute a modified version of the
2468
+ Combined Work produced by recombining or relinking the
2469
+ Application with a modified version of the Linked Version. (If
2470
+ you use option 4d0, the Installation Information must accompany
2471
+ the Minimal Corresponding Source and Corresponding Application
2472
+ Code. If you use option 4d1, you must provide the Installation
2473
+ Information in the manner specified by section 6 of the GNU GPL
2474
+ for conveying Corresponding Source.)
2475
+
2476
+ 5. Combined Libraries.
2477
+
2478
+ You may place library facilities that are a work based on the
2479
+ Library side by side in a single library together with other library
2480
+ facilities that are not Applications and are not covered by this
2481
+ License, and convey such a combined library under terms of your
2482
+ choice, if you do both of the following:
2483
+
2484
+ a) Accompany the combined library with a copy of the same work based
2485
+ on the Library, uncombined with any other library facilities,
2486
+ conveyed under the terms of this License.
2487
+
2488
+ b) Give prominent notice with the combined library that part of it
2489
+ is a work based on the Library, and explaining where to find the
2490
+ accompanying uncombined form of the same work.
2491
+
2492
+ 6. Revised Versions of the GNU Lesser General Public License.
2493
+
2494
+ The Free Software Foundation may publish revised and/or new versions
2495
+ of the GNU Lesser General Public License from time to time. Such new
2496
+ versions will be similar in spirit to the present version, but may
2497
+ differ in detail to address new problems or concerns.
2498
+
2499
+ Each version is given a distinguishing version number. If the
2500
+ Library as you received it specifies that a certain numbered version
2501
+ of the GNU Lesser General Public License "or any later version"
2502
+ applies to it, you have the option of following the terms and
2503
+ conditions either of that published version or of any later version
2504
+ published by the Free Software Foundation. If the Library as you
2505
+ received it does not specify a version number of the GNU Lesser
2506
+ General Public License, you may choose any version of the GNU Lesser
2507
+ General Public License ever published by the Free Software Foundation.
2508
+
2509
+ If the Library as you received it specifies that a proxy can decide
2510
+ whether future versions of the GNU Lesser General Public License shall
2511
+ apply, that proxy's public statement of acceptance of any version is
2512
+ permanent authorization for you to choose that version for the
2513
+ Library.
2514
+
2515
+ ```
2516
+
2342
2517
  ### eslint
2343
2518
 
2344
2519
  This product includes source derived from [eslint](https://github.com/eslint/eslint) ([v8.24.0](https://github.com/eslint/eslint/tree/v8.24.0)), distributed under the [MIT License](https://github.com/eslint/eslint/blob/v8.24.0/LICENSE):
@@ -9064,6 +9239,32 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
9064
9239
 
9065
9240
  ## optionalDependencies
9066
9241
 
9242
+ ### @contrast/fn-inspect
9243
+
9244
+ This product includes source derived from [@contrast/fn-inspect](https://github.com/Contrast-Security-Inc/node-fn-inspect) ([v3.3.0](https://github.com/Contrast-Security-Inc/node-fn-inspect/tree/v3.3.0)), distributed under the [MIT License](https://github.com/Contrast-Security-Inc/node-fn-inspect/blob/v3.3.0/LICENSE):
9245
+
9246
+ ```
9247
+ Copyright 2022 Contrast Security, Inc
9248
+
9249
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
9250
+ this software and associated documentation files (the "Software"), to deal in
9251
+ the Software without restriction, including without limitation the rights to
9252
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9253
+ the Software, and to permit persons to whom the Software is furnished to do so,
9254
+ subject to the following conditions:
9255
+
9256
+ The above copyright notice and this permission notice shall be included in all
9257
+ copies or substantial portions of the Software.
9258
+
9259
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
9260
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
9261
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
9262
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
9263
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
9264
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
9265
+
9266
+ ```
9267
+
9067
9268
  ### @newrelic/native-metrics
9068
9269
 
9069
9270
  This product includes source derived from [@newrelic/native-metrics](https://github.com/newrelic/node-native-metrics) ([v9.0.0](https://github.com/newrelic/node-native-metrics/tree/v9.0.0)), distributed under the [Apache-2.0 License](https://github.com/newrelic/node-native-metrics/blob/v9.0.0/LICENSE):