newrelic 9.0.1 → 9.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.
package/NEWS.md CHANGED
@@ -1,3 +1,17 @@
1
+ ### v9.0.2 (2022-08-23)
2
+
3
+ * Added unit test suite for `lib/logger.js`.
4
+
5
+ * Added destructive integration test for Configuration instantiation.
6
+
7
+ * Added a special case to serialize BigInts when sending them to New Relic. BigInts can appear in log data that our customers may be trying to forward.
8
+
9
+ * Exposed `compressed_content_encoding` configuration and defaulted it to "gzip".
10
+
11
+ * Fixed public jsdoc generation.
12
+
13
+ * Added`minami` back as a dev dependency for use with `jsdoc-conf.js`.
14
+
1
15
  ### v9.0.1 (2022-08-18)
2
16
 
3
17
  * Fixed properly setting logging metrics when using custom levels with winston.
@@ -53,6 +53,7 @@ code, the source code can be found at [https://github.com/newrelic/node-newrelic
53
53
  * [jsdoc](#jsdoc)
54
54
  * [lint-staged](#lint-staged)
55
55
  * [memcached](#memcached)
56
+ * [minami](#minami)
56
57
  * [nock](#nock)
57
58
  * [prettier](#prettier)
58
59
  * [proxyquire](#proxyquire)
@@ -2613,6 +2614,75 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2613
2614
  THE SOFTWARE.
2614
2615
  ```
2615
2616
 
2617
+ ### minami
2618
+
2619
+ This product includes source derived from [minami](https://github.com/Nijikokun/minami) ([v1.2.3](https://github.com/Nijikokun/minami/tree/v1.2.3)), distributed under the [Apache-2.0 License](https://github.com/Nijikokun/minami/blob/v1.2.3/LICENSE):
2620
+
2621
+ ```
2622
+ # License
2623
+
2624
+ Minami is free software, licensed under the Apache License, Version 2.0 (the
2625
+ "License"). Commercial and non-commercial use are permitted in compliance with
2626
+ the License.
2627
+
2628
+ Copyright (c) 2014-2015 Nijiko Yonskai <nijikokun@gmail.com> and the
2629
+ [contributors to Minami](https://github.com/Nijikokun/minami/graphs/contributors).
2630
+ All rights reserved.
2631
+
2632
+ You may obtain a copy of the License at:
2633
+ http://www.apache.org/licenses/LICENSE-2.0
2634
+
2635
+ In addition, a copy of the License is included with this distribution.
2636
+
2637
+ As stated in Section 7, "Disclaimer of Warranty," of the License:
2638
+
2639
+ > Licensor provides the Work (and each Contributor provides its Contributions)
2640
+ > on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
2641
+ > express or implied, including, without limitation, any warranties or
2642
+ > conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
2643
+ > PARTICULAR PURPOSE. You are solely responsible for determining the
2644
+ > appropriateness of using or redistributing the Work and assume any risks
2645
+ > associated with Your exercise of permissions under this License.
2646
+
2647
+ The source code for JSDoc 3 is available at:
2648
+ https://github.com/Nijikokun/minami
2649
+
2650
+ # Third-Party Software
2651
+
2652
+ Minami includes or depends upon the following third-party software, either in
2653
+ whole or in part. Each third-party software package is provided under its own
2654
+ license.
2655
+
2656
+ ## JSDoc 3
2657
+
2658
+ JSDoc 3 is free software, licensed under the Apache License, Version 2.0 (the
2659
+ "License"). Commercial and non-commercial use are permitted in compliance with
2660
+ the License.
2661
+
2662
+ Copyright (c) 2011-2015 Michael Mathews <micmath@gmail.com> and the
2663
+ [contributors to JSDoc](https://github.com/jsdoc3/jsdoc/graphs/contributors).
2664
+ All rights reserved.
2665
+
2666
+ You may obtain a copy of the License at:
2667
+ http://www.apache.org/licenses/LICENSE-2.0
2668
+
2669
+ In addition, a copy of the License is included with this distribution.
2670
+
2671
+ As stated in Section 7, "Disclaimer of Warranty," of the License:
2672
+
2673
+ > Licensor provides the Work (and each Contributor provides its Contributions)
2674
+ > on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
2675
+ > express or implied, including, without limitation, any warranties or
2676
+ > conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
2677
+ > PARTICULAR PURPOSE. You are solely responsible for determining the
2678
+ > appropriateness of using or redistributing the Work and assume any risks
2679
+ > associated with Your exercise of permissions under this License.
2680
+
2681
+ The source code for JSDoc 3 is available at:
2682
+ https://github.com/jsdoc3/jsdoc
2683
+
2684
+ ```
2685
+
2616
2686
  ### nock
2617
2687
 
2618
2688
  This product includes source derived from [nock](https://github.com/nock/nock) ([v11.8.0](https://github.com/nock/nock/tree/v11.8.0)), distributed under the [MIT License](https://github.com/nock/nock/blob/v11.8.0/LICENSE):
@@ -525,7 +525,7 @@ function transactionSampleData(traces, callback) {
525
525
  * @param logRecords
526
526
  * @param {Function} callback The continuation / error handler.
527
527
  */
528
- CollectorAPI.prototype.log_event_data = function errorData(logRecords, callback) {
528
+ CollectorAPI.prototype.log_event_data = function logEventData(logRecords, callback) {
529
529
  if (!callback) {
530
530
  throw new TypeError('callback is required')
531
531
  }
@@ -60,7 +60,7 @@ RemoteMethod.prototype.updateEndpoint = function updateEndpoint(endpoint) {
60
60
  RemoteMethod.prototype.serialize = function serialize(payload, callback) {
61
61
  let res
62
62
  try {
63
- res = stringify(payload)
63
+ res = stringify(payload, (key, value) => (typeof value === 'bigint' ? value.toString() : value))
64
64
  } catch (error) {
65
65
  logger.error(error, 'Unable to serialize payload for method %s.', this.name)
66
66
  return process.nextTick(function onNextTick() {
@@ -152,8 +152,8 @@ RemoteMethod.prototype._post = function _post(data, nrHeaders, callback) {
152
152
  if (options.compressed) {
153
153
  // NOTE: gzip and deflate throw immediately in Node 14+ with an invalid argument
154
154
  try {
155
- const useGzip = this._config.compressed_content_encoding === 'gzip'
156
- const compressor = useGzip ? zlib.gzip : zlib.deflate
155
+ const useDeflate = this._config.compressed_content_encoding === 'deflate'
156
+ const compressor = useDeflate ? zlib.deflate : zlib.gzip
157
157
  compressor(data, function onCompress(err, compressed) {
158
158
  if (err) {
159
159
  logger.warn(err, 'Error compressing JSON for delivery. Not sending.')
@@ -139,6 +139,16 @@ exports.config = () => ({
139
139
  */
140
140
  allow_all_headers: false,
141
141
 
142
+ /**
143
+ * If the data compression threshold is reached in the payload, the
144
+ * agent compresses data, using gzip compression by default. The
145
+ * config option `compressed_content_encoding` can be set to 'deflate'
146
+ * to use deflate compression.
147
+ *
148
+ * @env NEW_RELIC_COMPRESSED_CONTENT_ENCODING
149
+ */
150
+ compressed_content_encoding: 'gzip',
151
+
142
152
  /**
143
153
  * Attributes are key-value pairs containing information that determines
144
154
  * the properties of an event or transaction.
package/lib/config/env.js CHANGED
@@ -22,6 +22,7 @@ const ENV_MAPPING = {
22
22
  proxy_pass: 'NEW_RELIC_PROXY_PASS',
23
23
  agent_enabled: 'NEW_RELIC_ENABLED',
24
24
  allow_all_headers: 'NEW_RELIC_ALLOW_ALL_HEADERS',
25
+ compressed_content_encoding: 'NEW_RELIC_COMPRESSED_CONTENT_ENCODING',
25
26
  attributes: {
26
27
  enabled: 'NEW_RELIC_ATTRIBUTES_ENABLED',
27
28
  exclude: 'NEW_RELIC_ATTRIBUTES_EXCLUDE',
@@ -154,7 +154,6 @@ function Config(config) {
154
154
  this.browser_monitoring.loader_version = ''
155
155
 
156
156
  // Settings to play nice with DLPs (see NODE-1044).
157
- this.compressed_content_encoding = 'deflate' // Deflate or gzip
158
157
  this.simple_compression = false // Disables subcomponent compression
159
158
  this.put_for_data_send = false // Changes http verb for harvest
160
159
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "newrelic",
3
- "version": "9.0.1",
3
+ "version": "9.0.2",
4
4
  "author": "New Relic Node.js agent team <nodejs@newrelic.com>",
5
5
  "license": "Apache-2.0",
6
6
  "contributors": [
@@ -204,6 +204,7 @@
204
204
  "jsdoc": "^3.6.3",
205
205
  "lint-staged": "^11.0.0",
206
206
  "memcached": ">=0.2.8",
207
+ "minami": "^1.2.3",
207
208
  "nock": "11.8.0",
208
209
  "prettier": "^2.3.2",
209
210
  "proxyquire": "^1.8.0",