newrelic 6.13.2 → 7.0.2

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 (48) hide show
  1. package/NEWS.md +80 -7
  2. package/README.md +14 -5
  3. package/ROADMAP_Node.md +1 -1
  4. package/THIRD_PARTY_NOTICES.md +10 -12
  5. package/api.js +0 -32
  6. package/bin/run-versioned-tests.sh +3 -8
  7. package/index.js +5 -3
  8. package/lib/agent.js +4 -0
  9. package/lib/collector/api.js +2 -2
  10. package/lib/collector/http-agents.js +1 -1
  11. package/lib/collector/remote-method.js +18 -12
  12. package/lib/config/attribute-filter.js +1 -1
  13. package/lib/config/default.js +3 -11
  14. package/lib/config/env.js +0 -1
  15. package/lib/config/index.js +2 -23
  16. package/lib/db/parse-sql.js +1 -1
  17. package/lib/db/query-parsers/sql.js +1 -1
  18. package/lib/errors/error-collector.js +6 -1
  19. package/lib/errors/index.js +14 -1
  20. package/lib/grpc/connection.js +28 -4
  21. package/lib/instrumentation/core/http.js +34 -82
  22. package/lib/instrumentation/fastify/spec-builders.js +1 -1
  23. package/lib/metrics/names.js +4 -1
  24. package/lib/parse-proc-cpuinfo.js +1 -1
  25. package/lib/proxy/grpc.js +1 -1
  26. package/lib/serverless/aws-lambda.js +9 -23
  27. package/lib/shim/promise-shim.js +1 -1
  28. package/lib/shim/shim.js +3 -3
  29. package/lib/shim/transaction-shim.js +1 -1
  30. package/lib/shim/webframework-shim.js +1 -1
  31. package/lib/shimmer.js +1 -1
  32. package/lib/spans/create-span-event-aggregator.js +1 -1
  33. package/lib/spans/span-context.js +18 -0
  34. package/lib/spans/span-event.js +13 -2
  35. package/lib/spans/span-streamer.js +24 -13
  36. package/lib/spans/streaming-span-event-aggregator.js +4 -0
  37. package/lib/spans/streaming-span-event.js +13 -1
  38. package/lib/timer.js +1 -1
  39. package/lib/transaction/dt-payload.js +2 -2
  40. package/lib/transaction/handle.js +0 -54
  41. package/lib/transaction/index.js +25 -39
  42. package/lib/transaction/tracecontext.js +19 -4
  43. package/lib/util/byte-limit.js +1 -1
  44. package/lib/utilization/common.js +1 -1
  45. package/newrelic.js +1 -1
  46. package/package.json +11 -11
  47. package/stub_api.js +1 -1
  48. package/third_party_manifest.json +36 -36
package/NEWS.md CHANGED
@@ -1,4 +1,77 @@
1
- ## 6.13.2 (2020-10-13):
1
+ ### 7.0.2 (2020-12-01):
2
+
3
+ * Fixes a bug where the `http.statusCode` attribute was not being captured for an async invoked lambda.
4
+ * Fixed typos in code comments, documentation, and debugging logger messages.
5
+ Thank you @TysonAndre for the contribution.
6
+
7
+ ### 7.0.1 (2020-11-17):
8
+
9
+ * Fixed a bug where spans queued up during backpressure situations would be improperly formatted and ultimately dropped when sent to an Infinite Tracing trace observer.
10
+ * Updated @grpc/grpc-js to version v1.2.0.
11
+ * Updated tap to clear up npm audit issues around lodash sub-dependency.
12
+
13
+ ### 7.0.0 (2020-11-09):
14
+
15
+ * Added official parity support for Node 14
16
+
17
+ * Dropped Node v8.x support. For further information on our support policy,
18
+ see: https://docs.newrelic.com/docs/agents/nodejs-agent/getting-started/compatibility-requirements-nodejs-agent.
19
+ * Removed Node v8.x from CI
20
+ * Adds check that minimum Node version is >=10 and warns if >=15
21
+ * Sets Node engine to >=10
22
+ * **BREAKING** Dropped support for Node v8.x HTTP get() function signature
23
+ * strictly uses global.URL class in http core instrumentation
24
+ * removes Nodejs 8.x - 9.x checks
25
+ * Update New Relic Dependencies to versions with updated Node version support
26
+ * @newrelic/aws-sdk v3.0.0
27
+ * @newrelic/koa v5.0.0
28
+ * @newrelic/native-metrics v6.0.0
29
+ * @newrelic/superagent v4.0.0
30
+ * @newrelic/test-utilities v5.0.0
31
+
32
+ * **BREAKING** Removed deprecated setIgnoreTransaction API method
33
+
34
+ * **BREAKING** Removed deprecated httpResponseCode, response.status and
35
+ httpResponseMessage http response attributes
36
+
37
+ * **BREAKING** Removed the api.custom_parameters_enabled configuration item and
38
+ associated environment variable NEW_RELIC_API_CUSTOM_PARAMETERS. Please use
39
+ api.custom_attributes_enabled instead
40
+
41
+ * **BREAKING** Removed deprecated Distributed Tracing API methods,
42
+ createDistributedTracePayload() and acceptDistributedTracePayload()
43
+
44
+ * Finalized removal of ignored_params and capture_params
45
+
46
+ * Added additional logging to W3C Trace Context header creation
47
+
48
+ ### 6.14.0 (2020-10-28):
49
+
50
+ * Updated README for consistency.
51
+
52
+ * Fixed issue where gRPC connection used for infinite tracing could throw if the server
53
+ shutdown during disconnect of an existing connection.
54
+
55
+ * Bumped @grpc/grpc-js to 1.1.7.
56
+
57
+ * Bumped @grpc/proto-loader to ^0.5.5.
58
+
59
+ * Infinite tracing logging and support metric improvements.
60
+
61
+ * Increased logging level of certain infinite tracing / gRPC errors.
62
+ * Decreased logging interval of dropped span warning for infinite tracing.
63
+ * Added additional support metrics and logging for infinite tracing.
64
+
65
+ * Fixed bug where errors would still be collected for transactions with ignored error
66
+ status codes in certain situations.
67
+
68
+ * Converted errors ignore unit tests to tap API.
69
+
70
+ * Added Node 14 to CI test coverage.
71
+
72
+ Many thanks to @jgeurts for the contribution.
73
+
74
+ ### 6.13.2 (2020-10-13):
2
75
 
3
76
  * Removed lodash as a development dependency
4
77
 
@@ -10,7 +83,7 @@
10
83
 
11
84
  Thank you to @ronen-e for the contribution!
12
85
 
13
- ## 6.13.1 (2020-09-24):
86
+ ### 6.13.1 (2020-09-24):
14
87
 
15
88
  * Fixed named-pipe check for lambda invocations to avoid race-condition.
16
89
 
@@ -269,7 +342,7 @@ Special thanks to Ryan Copley (@RyanCopley) for the contribution.
269
342
  object from API#getLinkingMetadata().
270
343
 
271
344
  This issue would cause the `@newrelic/winston-enricher` module to crash when
272
- attempting to inject log metatdata.
345
+ attempting to inject log metadata.
273
346
 
274
347
  * Reduced logging level of raw `x-queue-start` or `x-request-start` header values
275
348
  to avoid logging very large values at default logging levels.
@@ -3221,7 +3294,7 @@ Special thanks to Ryan Copley (@RyanCopley) for the contribution.
3221
3294
 
3222
3295
  * Fixed a bug where custom events weren't being sent.
3223
3296
 
3224
- In a refactor of our data collection cycle, we omited the custom
3297
+ In a refactor of our data collection cycle, we omitted the custom
3225
3298
  events from the list of commands, this is now fixed.
3226
3299
 
3227
3300
  * Fixed a very rare bug where the custom event pool could be set to 10
@@ -3445,7 +3518,7 @@ Special thanks to Ryan Copley (@RyanCopley) for the contribution.
3445
3518
  ended when the view ended.
3446
3519
 
3447
3520
  * Added a configuration option to completely disable logging. `logger.enabled`
3448
- defaults to true, if set to false it wont try to create the log file.
3521
+ defaults to true, if set to false it won't try to create the log file.
3449
3522
 
3450
3523
  ### v1.16.2 (2015-02-13):
3451
3524
 
@@ -4216,7 +4289,7 @@ Special thanks to Ryan Copley (@RyanCopley) for the contribution.
4216
4289
  too many times. Thanks to José F. Romaniello for confirming the fix.
4217
4290
  * Changed how requests handled by Express and Restify routes are named. This
4218
4291
  change is being rolled out both in this module and on the New Relic website,
4219
- so there is a chance you will see the same route (or very similiar routes)
4292
+ so there is a chance you will see the same route (or very similar routes)
4220
4293
  show up twice in aggregated metrics.
4221
4294
  * Dropped the default apdex tolerating value from 500 milliseconds to 100
4222
4295
  milliseconds. This means that transactions slower than 400 milliseconds will
@@ -4453,7 +4526,7 @@ Special thanks to Ryan Copley (@RyanCopley) for the contribution.
4453
4526
  crash.
4454
4527
  * Some metric normalization rules were not being interpreted correctly, leading
4455
4528
  to malformed normalized metric names.
4456
- * Metric normalization rules that specifed that matching metrics were to be
4529
+ * Metric normalization rules that specified that matching metrics were to be
4457
4530
  ignored were not being enforced.
4458
4531
 
4459
4532
  ### v0.9.12-91 / beta-12 (2012-12-28):
package/README.md CHANGED
@@ -10,7 +10,7 @@ In order to take full advantage of this package, make sure you have a [New Relic
10
10
 
11
11
  As with any instrumentation tool, please test before using in production.
12
12
 
13
- ## Installation and getting started
13
+ ## Installation
14
14
 
15
15
  To use New Relic's Node.js agent entails these three steps, which are described in detail below:
16
16
 
@@ -57,9 +57,13 @@ If you're compiling your JavaScript and can't control the final `require` order,
57
57
  $ node -r newrelic your-program.js
58
58
  $ node --require newrelic your-program.js
59
59
 
60
+ ## Getting Started
61
+
60
62
  For more information on getting started, [check the Node.js docs](https://docs.newrelic.com/docs/agents/nodejs-agent/getting-started/introduction-new-relic-nodejs).
61
63
 
62
- ## Using the API
64
+ ## Usage
65
+
66
+ ### Using the API
63
67
 
64
68
  The `newrelic` module returns an object with the Node agent's API methods attached.
65
69
 
@@ -72,7 +76,7 @@ The `newrelic` module returns an object with the Node agent's API methods attach
72
76
 
73
77
  You can read more about using the API over on the [New Relic documentation](https://docs.newrelic.com/docs/agents/nodejs-agent/api-guides/guide-using-nodejs-agent-api) site.
74
78
 
75
- ## Core agent development and tests
79
+ ## Testing
76
80
 
77
81
  These are the steps to work on core agent features, with more detail below:
78
82
 
@@ -149,17 +153,22 @@ Please review [New Relic’s General Data Privacy Notice](https://newrelic.com/t
149
153
 
150
154
  See our [roadmap](./ROADMAP_Node.md), to learn more about our product vision, understand our plans, and provide us valuable feedback.
151
155
 
152
- ## Contributing
156
+ ## Contribute
153
157
 
154
158
  We encourage your contributions to improve the Node.js agent! Keep in mind when you submit your pull request, you'll need to sign the CLA via the click-through using CLA-Assistant. You only have to sign the CLA one time per project.
159
+
155
160
  If you have any questions, or to execute our corporate CLA, required if your contribution is on behalf of a company, please drop us an email at opensource@newrelic.com.
156
161
 
157
162
  **A note about vulnerabilities**
158
163
 
159
- As noted in our [security policy](https://github.com/newrelic/node-newrelic/security/policy), New Relic is committed to the privacy and security of our customers and their data. We believe that providing coordinated disclosure by security researchers and engaging with the security community are important means to achieve our security goals.
164
+ As noted in our [security policy](../../security/policy), New Relic is committed to the privacy and security of our customers and their data. We believe that providing coordinated disclosure by security researchers and engaging with the security community are important means to achieve our security goals.
160
165
 
161
166
  If you believe you have found a security vulnerability in this project or any of New Relic's products or websites, we welcome and greatly appreciate you reporting it to New Relic through [HackerOne](https://hackerone.com/newrelic).
162
167
 
168
+ If you would like to contribute to this project, review [these guidelines](./CONTRIBUTING.md).
169
+
170
+ To [all contributors](https://github.com/newrelic/node-newrelic/graphs/contributors), we thank you! Without your contribution, this project would not be what it is today. We also host a community project page dedicated to [New Relic Node Agent](https://opensource.newrelic.com/projects/newrelic/node-newrelic).
171
+
163
172
  ## License
164
173
 
165
174
  The Node.js agent is licensed under the [Apache 2.0](http://apache.org/licenses/LICENSE-2.0.txt) License.
package/ROADMAP_Node.md CHANGED
@@ -15,7 +15,7 @@ This roadmap project is broken down into the following sections:
15
15
  - **Next**:
16
16
  - This section contains work planned within the next three months. These features may still be deprioritized and moved to Future.
17
17
  - **Future**:
18
- - This section is for ideas for future work that is alined with the product vision and possible opportunities for community contribution. It contains a list of features that anyone can implement. No guarantees can be provided on if or when these features will be completed.
18
+ - This section is for ideas for future work that is aligned with the product vision and possible opportunities for community contribution. It contains a list of features that anyone can implement. No guarantees can be provided on if or when these features will be completed.
19
19
 
20
20
 
21
21
  **The roadmap project is found [here](https://github.com/orgs/newrelic/projects/11)**
@@ -68,15 +68,12 @@ code, the source code can be found at [https://github.com/newrelic/node-newrelic
68
68
  * [through](#through)
69
69
  * [when](#when)
70
70
 
71
- **[additional-licenses](#additional-licenses)**
72
-
73
- * [symantec](#symantec)
74
71
 
75
72
  ## dependencies
76
73
 
77
74
  ### @grpc/grpc-js
78
75
 
79
- This product includes source derived from [@grpc/grpc-js](https://github.com/grpc/grpc-node/tree/master/packages/grpc-js) ([v1.0.5](https://github.com/grpc/grpc-node/tree/master/packages/grpc-js/tree/v1.0.5)), distributed under the [Apache-2.0 License](https://github.com/grpc/grpc-node/tree/master/packages/grpc-js/blob/v1.0.5/LICENSE):
76
+ This product includes source derived from [@grpc/grpc-js](https://github.com/grpc/grpc-node/tree/master/packages/grpc-js) ([v1.2.0](https://github.com/grpc/grpc-node/tree/master/packages/grpc-js/tree/v1.2.0)), distributed under the [Apache-2.0 License](https://github.com/grpc/grpc-node/tree/master/packages/grpc-js/blob/v1.2.0/LICENSE):
80
77
 
81
78
  ```
82
79
  Apache License
@@ -285,7 +282,7 @@ This product includes source derived from [@grpc/grpc-js](https://github.com/grp
285
282
 
286
283
  ### @grpc/proto-loader
287
284
 
288
- This product includes source derived from [@grpc/proto-loader](https://github.com/grpc/grpc-node) ([v0.5.4](https://github.com/grpc/grpc-node/tree/v0.5.4)), distributed under the [Apache-2.0 License](https://github.com/grpc/grpc-node/blob/v0.5.4/LICENSE):
285
+ This product includes source derived from [@grpc/proto-loader](https://github.com/grpc/grpc-node) ([v0.5.5](https://github.com/grpc/grpc-node/tree/v0.5.5)), distributed under the [Apache-2.0 License](https://github.com/grpc/grpc-node/blob/v0.5.5/LICENSE):
289
286
 
290
287
  ```
291
288
  Apache License
@@ -494,7 +491,7 @@ This product includes source derived from [@grpc/proto-loader](https://github.co
494
491
 
495
492
  ### @newrelic/aws-sdk
496
493
 
497
- This product includes source derived from [@newrelic/aws-sdk](https://github.com/newrelic/node-newrelic-aws-sdk) ([v2.0.0](https://github.com/newrelic/node-newrelic-aws-sdk/tree/v2.0.0)), distributed under the [Apache-2.0 License](https://github.com/newrelic/node-newrelic-aws-sdk/blob/v2.0.0/LICENSE):
494
+ This product includes source derived from [@newrelic/aws-sdk](https://github.com/newrelic/node-newrelic-aws-sdk) ([v3.0.0](https://github.com/newrelic/node-newrelic-aws-sdk/tree/v3.0.0)), distributed under the [Apache-2.0 License](https://github.com/newrelic/node-newrelic-aws-sdk/blob/v3.0.0/LICENSE):
498
495
 
499
496
  ```
500
497
  Apache License
@@ -702,7 +699,7 @@ This product includes source derived from [@newrelic/aws-sdk](https://github.com
702
699
 
703
700
  ### @newrelic/koa
704
701
 
705
- This product includes source derived from [@newrelic/koa](https://github.com/newrelic/node-newrelic-koa) ([v4.0.0](https://github.com/newrelic/node-newrelic-koa/tree/v4.0.0)), distributed under the [Apache-2.0 License](https://github.com/newrelic/node-newrelic-koa/blob/v4.0.0/LICENSE):
702
+ This product includes source derived from [@newrelic/koa](https://github.com/newrelic/node-newrelic-koa) ([v5.0.0](https://github.com/newrelic/node-newrelic-koa/tree/v5.0.0)), distributed under the [Apache-2.0 License](https://github.com/newrelic/node-newrelic-koa/blob/v5.0.0/LICENSE):
706
703
 
707
704
  ```
708
705
  Apache License
@@ -911,7 +908,7 @@ Apache License
911
908
 
912
909
  ### @newrelic/superagent
913
910
 
914
- This product includes source derived from [@newrelic/superagent](https://github.com/newrelic/node-newrelic-superagent) ([v3.0.0](https://github.com/newrelic/node-newrelic-superagent/tree/v3.0.0)), distributed under the [Apache-2.0 License](https://github.com/newrelic/node-newrelic-superagent/blob/v3.0.0/LICENSE):
911
+ This product includes source derived from [@newrelic/superagent](https://github.com/newrelic/node-newrelic-superagent) ([v4.0.0](https://github.com/newrelic/node-newrelic-superagent/tree/v4.0.0)), distributed under the [Apache-2.0 License](https://github.com/newrelic/node-newrelic-superagent/blob/v4.0.0/LICENSE):
915
912
 
916
913
  ```
917
914
  Apache License
@@ -1323,7 +1320,7 @@ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1323
1320
  ## optionalDependencies
1324
1321
 
1325
1322
  ### @newrelic/native-metrics
1326
- This product includes source derived from [@newrelic/native-metrics](https://github.com/newrelic/node-native-metrics) ([v5.3.0](https://github.com/newrelic/node-native-metrics/tree/v5.3.0)), distributed under the [Apache-2.0 License](https://github.com/newrelic/node-native-metrics/blob/v5.3.0/LICENSE):
1323
+ This product includes source derived from [@newrelic/native-metrics](https://github.com/newrelic/node-native-metrics) ([v6.0.0](https://github.com/newrelic/node-native-metrics/tree/v6.0.0)), distributed under the [Apache-2.0 License](https://github.com/newrelic/node-native-metrics/blob/v6.0.0/LICENSE):
1327
1324
 
1328
1325
  ```
1329
1326
  Apache License
@@ -1548,7 +1545,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
1548
1545
 
1549
1546
  ### @newrelic/test-utilities
1550
1547
 
1551
- This product includes source derived from [@newrelic/test-utilities](https://github.com/newrelic/node-test-utilities) ([v4.0.0](https://github.com/newrelic/node-test-utilities/tree/v4.0.0)), distributed under the [Apache-2.0 License](https://github.com/newrelic/node-test-utilities/blob/v4.0.0/LICENSE):
1548
+ This product includes source derived from [@newrelic/test-utilities](https://github.com/newrelic/node-test-utilities) ([v5.0.0](https://github.com/newrelic/node-test-utilities/tree/v5.0.0)), distributed under the [Apache-2.0 License](https://github.com/newrelic/node-test-utilities/blob/v5.0.0/LICENSE):
1552
1549
 
1553
1550
  ```
1554
1551
  Apache License
@@ -2888,7 +2885,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2888
2885
 
2889
2886
  ### tap
2890
2887
 
2891
- This product includes source derived from [tap](https://github.com/tapjs/node-tap) ([v14.10.7](https://github.com/tapjs/node-tap/tree/v14.10.7)), distributed under the [ISC License](https://github.com/tapjs/node-tap/blob/v14.10.7/LICENSE):
2888
+ This product includes source derived from [tap](https://github.com/tapjs/node-tap) ([v14.10.8](https://github.com/tapjs/node-tap/tree/v14.10.8)), distributed under the [ISC License](https://github.com/tapjs/node-tap/blob/v14.10.8/LICENSE):
2892
2889
 
2893
2890
  ```
2894
2891
  The ISC License
@@ -3000,6 +2997,7 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
3000
2997
  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3001
2998
  ```
3002
2999
 
3000
+
3003
3001
  ## additional-licenses
3004
3002
 
3005
3003
  ### symantec
@@ -3204,4 +3202,4 @@ Root Certificate License Agreement v3.0 (January 2014)
3204
3202
  Portions copyright Node.js contributors. Depending on your existing libraries and package management settings,
3205
3203
  your systems may call externally maintained libraries in addition to those listed above.
3206
3204
  See [here](https://nodejs.org/en/docs/meta/topics/dependencies/) and [here](https://github.com/nodejs/node/blob/v4.3.1/LICENSE)
3207
- for additional details regarding externally maintained libraries and certain related licenses and notices.”
3205
+ for additional details regarding externally maintained libraries and certain related licenses and notices.”
package/api.js CHANGED
@@ -430,38 +430,6 @@ API.prototype.addCustomSpanAttribute = function addCustomSpanAttribute(key, valu
430
430
  spanContext.addCustomAttribute(key, value)
431
431
  }
432
432
 
433
- API.prototype.setIgnoreTransaction = util.deprecate(
434
- setIgnoreTransaction, [
435
- 'API#setIgnoreTransaction is being deprecated!',
436
- 'Please use TransactionHandle#ignore to ignore a transaction.',
437
- 'Use API#getTransaction to create a new TransactionHandle instance.'
438
- ].join(' ')
439
- )
440
-
441
- /**
442
- * Tell the tracer whether to ignore the current transaction. The most common
443
- * use for this will be to mark a transaction as ignored (maybe it's handling
444
- * a websocket polling channel, or maybe it's an external call you don't care
445
- * is slow), but it's also useful when you want a transaction that would
446
- * otherwise be ignored due to URL or transaction name normalization rules
447
- * to *not* be ignored.
448
- *
449
- * @param {boolean} ignored Ignore, or don't ignore, the current transaction.
450
- */
451
- function setIgnoreTransaction(ignored) {
452
- var metric = this.agent.metrics.getOrCreateMetric(
453
- NAMES.SUPPORTABILITY.API + '/setIgnoreTransaction'
454
- )
455
- metric.incrementCallCount()
456
-
457
- var transaction = this.agent.tracer.getTransaction()
458
- if (!transaction) {
459
- return logger.warn("No transaction found to ignore.")
460
- }
461
-
462
- transaction.setForceIgnore(ignored)
463
- }
464
-
465
433
  /**
466
434
  * Send errors to New Relic that you've already handled yourself. Should be an
467
435
  * `Error` or one of its subtypes, but the API will handle strings and objects
@@ -24,14 +24,9 @@ fi
24
24
 
25
25
  export AGENT_PATH=`pwd`
26
26
 
27
- # @koa/router 8.03+ breaks segment naming for nested routes
28
- skip="koa"
29
-
30
27
  # Don't run the aws-sdk tests if we don't have the keys set
31
28
  if [[ -z "$AWS_ACCESS_KEY_ID" ]]; then
32
- skip="${skip},aws-sdk"
29
+ time ./node_modules/.bin/versioned-tests $VERSIONED_MODE -i 2 -s aws-sdk ${directories[@]}
30
+ else
31
+ time ./node_modules/.bin/versioned-tests $VERSIONED_MODE -i 2 ${directories[@]}
33
32
  fi
34
-
35
-
36
- # This is meant to be temporary. Remove once new major version with fixes rolled into agent.
37
- time ./node_modules/.bin/versioned-tests $VERSIONED_MODE -i 2 -s $skip ${directories[@]}
package/index.js CHANGED
@@ -48,14 +48,16 @@ function initialize() {
48
48
  preAgentTime
49
49
  )
50
50
 
51
- // TODO: Update this check when Node v8 is deprecated.
52
- if (psemver.satisfies('<8.0.0')) {
51
+ // TODO: Update this check when Node v10 is deprecated.
52
+ if (psemver.satisfies('<10.0.0')) {
53
53
  message = 'New Relic for Node.js requires a version of Node equal to or\n' +
54
54
  'greater than 8.0.0. Not starting!'
55
55
 
56
56
  logger.error(message)
57
57
  throw new Error(message)
58
- } else if (!psemver.satisfies(pkgJSON.engines.node)) {
58
+
59
+ // TODO: Update this check when Node v16 support is added
60
+ } else if (!psemver.satisfies(pkgJSON.engines.node) || psemver.satisfies('>=15.0.0')) {
59
61
  logger.warn(
60
62
  'New Relic for Node.js %s has not been tested on Node.js %s. Please ' +
61
63
  'update the agent or downgrade your version of Node.js',
package/lib/agent.js CHANGED
@@ -581,6 +581,10 @@ Agent.prototype._beforeMetricDataSend = function _beforeMetricDataSend() {
581
581
 
582
582
  // Send uninstrumented supportability metrics every metric harvest cycle
583
583
  uninstrumented.createMetrics(this.metrics)
584
+
585
+ if (this.spanEventAggregator.isStream) {
586
+ this.spanEventAggregator.createMetrics()
587
+ }
584
588
  }
585
589
 
586
590
  Agent.prototype._generateEntityStatsAndClear = function _generateHarvestMetrics() {
@@ -511,12 +511,12 @@ CollectorAPI.prototype._sendData = function _sendData(method, data, callback) {
511
511
  if (response.agentRun === AGENT_RUN_BEHAVIOR.SHUTDOWN) {
512
512
  // TODO: for now, shut handled in _handleResponseCode for consistency
513
513
  // either find way to safely change while side-by-side or move
514
- // once side-by-side gone. Currently, stop is called twice on teh old code path
514
+ // once side-by-side gone. Currently, stop is called twice on the old code path
515
515
 
516
516
  // TODO: almost seems better to let aggregator finish (cb) then shutdown?
517
517
 
518
518
  // this._agent.stop((err) => {
519
- // // TODO: agent stop requires a callback. if we don't care to do anythig here
519
+ // // TODO: agent stop requires a callback. if we don't care to do anything here
520
520
  // // do we loosen that requirement or perhaps have a different "shutdown"
521
521
  // // method? Does seem like you'd want to log a shutdown error
522
522
  // // but don't really care about that *here*
@@ -42,7 +42,7 @@ exports.keepAliveAgent = function keepAliveAgent(config) {
42
42
  * NPM package with configuration suitable for working via
43
43
  * the configured newrelic-agent's proxy configuration.
44
44
  *
45
- * Include keep-alive configuration, but ultimatly its up
45
+ * Include keep-alive configuration, but ultimately its up
46
46
  * to the proxy server as to how its connection is made
47
47
  * with New Relic's servers.
48
48
  */
@@ -107,17 +107,23 @@ RemoteMethod.prototype._post = function _post(data, nrHeaders, callback) {
107
107
  }
108
108
 
109
109
  if (options.compressed) {
110
- var useGzip = this._config.compressed_content_encoding === 'gzip'
111
- var compressor = useGzip ? zlib.gzip : zlib.deflate
112
- compressor(data, function onCompress(err, compressed) {
113
- if (err) {
114
- logger.warn(err, 'Error compressing JSON for delivery. Not sending.')
115
- return callback(err)
116
- }
117
-
118
- options.body = compressed
119
- makeRequest()
120
- })
110
+ // NOTE: gzip and deflate throw immediately in Node 14+ with an invalid argument
111
+ try {
112
+ var useGzip = this._config.compressed_content_encoding === 'gzip'
113
+ var compressor = useGzip ? zlib.gzip : zlib.deflate
114
+ compressor(data, function onCompress(err, compressed) {
115
+ if (err) {
116
+ logger.warn(err, 'Error compressing JSON for delivery. Not sending.')
117
+ return callback(err)
118
+ }
119
+
120
+ options.body = compressed
121
+ makeRequest()
122
+ })
123
+ } catch (err) {
124
+ logger.warn(err, 'Error compressing JSON for delivery. Not sending.')
125
+ return callback(err)
126
+ }
121
127
  } else {
122
128
  options.body = data
123
129
  makeRequest()
@@ -184,7 +190,7 @@ RemoteMethod.prototype._safeRequest = function _safeRequest(options) {
184
190
  throw new Error('Maximum payload size exceeded')
185
191
  }
186
192
 
187
- // If trace level is not explicity enabled check to see if the audit log is
193
+ // If trace level is not explicitly enabled check to see if the audit log is
188
194
  // enabled.
189
195
  if (logConfig != null && logConfig.level !== 'trace' && auditLog.enabled) {
190
196
  // If the filter property is empty, then always log the event otherwise
@@ -145,7 +145,7 @@ AttributeFilter.prototype._filter = function _filter(scope, destinations, key) {
145
145
  var globalInclude = null
146
146
  var globalExclude = null
147
147
 
148
- // Iterate over each desination and see if the rules apply.
148
+ // Iterate over each destination and see if the rules apply.
149
149
  for (var i = 0; i < scope.length; ++i) {
150
150
  var dest = scope[i]
151
151
  var destId = dest.id
@@ -231,7 +231,7 @@ exports.config = () => ({
231
231
  enabled: false,
232
232
 
233
233
  /**
234
- * Specify which methods are logged. Used in conjuction with the audit_log flag
234
+ * Specify which methods are logged. Used in conjunction with the audit_log flag
235
235
  * If audit_log is enabled and this property is empty, all methods will be logged
236
236
  * Otherwise, if the audit log is enabled, only the methods specified
237
237
  * in the filter will be logged
@@ -340,7 +340,7 @@ exports.config = () => ({
340
340
  detect_aws: true,
341
341
  /**
342
342
  * This flag dictates whether the agent attempts to detect if the
343
- * the process is running on Pivotal Cloud Foundary.
343
+ * the process is running on Pivotal Cloud Foundry.
344
344
  *
345
345
  * @env NEW_RELIC_UTILIZATION_DETECT_PCF
346
346
  */
@@ -595,14 +595,6 @@ exports.config = () => ({
595
595
  * options are disabled when high-security mode is enabled.
596
596
  */
597
597
  api: {
598
- /**
599
- * Deprecated. Please use `api.custom_attributes_enabled` instead.
600
- *
601
- * @env NEW_RELIC_API_CUSTOM_PARAMETERS
602
- */
603
- // TODO: This somehow survived the v5 cut, even though
604
- // it's already removed from docs site. Remove in v6.
605
- custom_parameters_enabled: true,
606
598
  /**
607
599
  * Controls for the `API.addCustomAttribute` method.
608
600
  *
@@ -854,7 +846,7 @@ exports.config = () => ({
854
846
  enabled: false,
855
847
 
856
848
  /**
857
- * Exludes New Relic format distributed tracing header (`newrelic`) on
849
+ * Excludes New Relic format distributed tracing header (`newrelic`) on
858
850
  * outbound requests when set to `true`. By default (when false)
859
851
  * both W3C TraceContext (`traceparent`, `tracecontext`) and
860
852
  * New Relic formats will be sent.
package/lib/config/env.js CHANGED
@@ -106,7 +106,6 @@ const ENV_MAPPING = {
106
106
  },
107
107
  api: {
108
108
  custom_attributes_enabled: 'NEW_RELIC_API_CUSTOM_ATTRIBUTES',
109
- custom_parameters_enabled: 'NEW_RELIC_API_CUSTOM_PARAMETERS',
110
109
  custom_events_enabled: 'NEW_RELIC_API_CUSTOM_EVENTS',
111
110
  notice_error_enabled: 'NEW_RELIC_API_NOTICE_ERROR'
112
111
  },
@@ -1025,15 +1025,6 @@ Config.prototype._fromPassed = function _fromPassed(external, internal, arbitrar
1025
1025
  return
1026
1026
  }
1027
1027
 
1028
- // TODO: remove in v6
1029
- if (key === 'ignored_params') {
1030
- warnDeprecated(key, 'attributes.exclude')
1031
- }
1032
-
1033
- if (key === 'capture_params') {
1034
- warnDeprecated(key, 'attributes.enabled')
1035
- }
1036
-
1037
1028
  try {
1038
1029
  var node = external[key]
1039
1030
  } catch (err) {
@@ -1049,14 +1040,6 @@ Config.prototype._fromPassed = function _fromPassed(external, internal, arbitrar
1049
1040
  internal[key] = node
1050
1041
  }
1051
1042
  }, this)
1052
-
1053
- function warnDeprecated(key, replacement) {
1054
- logger.warn(
1055
- 'Config key %s is deprecated, please use %s instead',
1056
- key,
1057
- replacement
1058
- )
1059
- }
1060
1043
  }
1061
1044
 
1062
1045
  /**
@@ -1327,10 +1310,6 @@ Config.prototype._canonicalize = function _canonicalize() {
1327
1310
  )
1328
1311
  }
1329
1312
 
1330
- this.api.custom_attributes_enabled = !this.api.custom_attributes_enabled
1331
- ? this.api.custom_attributes_enabled
1332
- : this.api.custom_parameters_enabled
1333
-
1334
1313
  this.serverless_mode.enabled = this.serverless_mode.enabled
1335
1314
  && this.feature_flag.serverless_mode
1336
1315
 
@@ -1481,7 +1460,7 @@ Config.prototype.applyLasp = function applyLasp(agent, policies) {
1481
1460
  var localVal = settingBlock[valueName]
1482
1461
 
1483
1462
  // Indexes into "allowed values" based on "enabled" setting
1484
- // to retreive proper mapping.
1463
+ // to retrieve proper mapping.
1485
1464
  var policyValues = localMapping.allowedValues
1486
1465
  var policyValue = policyValues[policy.enabled ? 1 : 0]
1487
1466
 
@@ -1623,7 +1602,7 @@ Config.prototype.getAggregatorConfig = function getAggregatorConfig(method) {
1623
1602
  * 5. If this module is installed as a dependency, the directory above the
1624
1603
  * node_modules folder in which newrelic is installed.
1625
1604
  *
1626
- * For configration via environment (useful on Joyent, Azure, Heroku, or
1605
+ * For configuration via environment (useful on Joyent, Azure, Heroku, or
1627
1606
  * other PaaS offerings), set NEW_RELIC_NO_CONFIG_FILE to something truthy
1628
1607
  * and read README.md for details on what configuration variables are
1629
1608
  * necessary, as well as a complete enumeration of the other available
@@ -22,7 +22,7 @@ var OPERATIONS = [
22
22
  ]
23
23
  var COMMENT_PATTERN = /\/\\*.*?\\*\//
24
24
 
25
- // This must be called syncronously after the initial db call for backtraces to
25
+ // This must be called synchronously after the initial db call for backtraces to
26
26
  // work correctly
27
27
 
28
28
  module.exports = function parseSql(type, sql) {
@@ -24,7 +24,7 @@ var OPERATIONS = [
24
24
  ]
25
25
  var COMMENT_PATTERN = /\/\\*.*?\\*\//g
26
26
 
27
- // This must be called syncronously after the initial db call for backtraces to
27
+ // This must be called synchronously after the initial db call for backtraces to
28
28
  // work correctly
29
29
 
30
30
  module.exports = function parseSql(sql) {
@@ -142,13 +142,18 @@ class ErrorCollector {
142
142
  }
143
143
 
144
144
  const isErroredTransaction = urltils.isError(this.config, transaction.statusCode)
145
+ const isIgnoredErrorStatusCode = urltils.isIgnoredError(
146
+ this.config,
147
+ transaction.statusCode
148
+ )
149
+
145
150
  const isExpectedErrorStatusCode = urltils.isExpectedError(
146
151
  this.config,
147
152
  transaction.statusCode
148
153
  )
149
154
 
150
155
  // collect other exceptions only if status code is not ignored
151
- if (transaction.exceptions.length) {
156
+ if (transaction.exceptions.length && !isIgnoredErrorStatusCode) {
152
157
  for (let i = 0; i < transaction.exceptions.length; i++) {
153
158
  const exception = transaction.exceptions[i]
154
159
  if (this.collect(transaction, exception)) {
@@ -20,7 +20,20 @@ class Exception {
20
20
  }
21
21
 
22
22
  getErrorDetails(config) {
23
- return errorHelper.extractErrorInformation(null, this.error, config)
23
+ const errorDetails = errorHelper.extractErrorInformation(null, this.error, config)
24
+ errorDetails.expected = this.isExpected(config, errorDetails)
25
+
26
+ return errorDetails
27
+ }
28
+
29
+ isExpected(config, {type, message}) {
30
+ if (!this._expected) {
31
+ this._expected =
32
+ errorHelper.isExpectedErrorClass(config, type) ||
33
+ errorHelper.isExpectedErrorMessage(config, type, message)
34
+ }
35
+
36
+ return this._expected
24
37
  }
25
38
  }
26
39