newrelic 9.10.0 → 9.10.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,13 @@
1
+ ### v9.10.2 (2023-02-21)
2
+
3
+ * fix: Replaced `request.aborted` with `response.close` in HTTP instrumentation.
4
+ * Fixed issue where setting `NEW_RELIC_GRPC_IGNORE_STATUS_CODES` was not properly parsing the codes as integers, thus not ignoring reporting errors of certain status codes.
5
+ * Upgraded `@grpc/grpc-js` from 1.8.4 to 1.8.7.
6
+
7
+ ### v9.10.1 (2023-02-13)
8
+
9
+ * Fixed error with Lambda/ALB serverless instrumentation when no response headers were included
10
+
1
11
  ### v9.10.0 (2023-02-09)
2
12
 
3
13
  * Exposed a method on [API](https://newrelic.github.io/node-newrelic/API.html#obfuscateSql) to obfuscate sql: `newrelic.obfuscateSql`.
@@ -1285,16 +1285,21 @@ Config.prototype._enforceServerless = function _enforceServerless(inputConfig) {
1285
1285
  * based on special properties of configuration values should go here as well.
1286
1286
  */
1287
1287
  Config.prototype._canonicalize = function _canonicalize() {
1288
- const statusCodes = this.error_collector && this.error_collector.ignore_status_codes
1288
+ const statusCodes = this?.error_collector?.ignore_status_codes
1289
1289
  if (statusCodes) {
1290
1290
  this.error_collector.ignore_status_codes = _parseCodes(statusCodes)
1291
1291
  }
1292
1292
 
1293
- const expectedCodes = this.error_collector && this.error_collector.expected_status_codes
1293
+ const expectedCodes = this?.error_collector?.expected_status_codes
1294
1294
  if (expectedCodes) {
1295
1295
  this.error_collector.expected_status_codes = _parseCodes(expectedCodes)
1296
1296
  }
1297
1297
 
1298
+ const grpcStatusCodes = this?.grpc?.ignore_status_codes
1299
+ if (grpcStatusCodes) {
1300
+ this.grpc.ignore_status_codes = _parseCodes(grpcStatusCodes)
1301
+ }
1302
+
1298
1303
  const logAliases = {
1299
1304
  verbose: 'trace',
1300
1305
  debugging: 'debug',
@@ -146,7 +146,7 @@ function wrapEmitWithTransaction(agent, emit, isHTTPS) {
146
146
  function instrumentedFinish() {
147
147
  // Remove listeners so this doesn't get called twice.
148
148
  response.removeListener('finish', instrumentedFinish)
149
- request.removeListener('aborted', instrumentedFinish)
149
+ response.removeListener('close', instrumentedFinish)
150
150
 
151
151
  // Naming must happen before the segment and transaction are ended,
152
152
  // because metrics recording depends on naming's side effects.
@@ -188,7 +188,7 @@ function wrapEmitWithTransaction(agent, emit, isHTTPS) {
188
188
  transaction.end()
189
189
  }
190
190
  response.once('finish', instrumentedFinish)
191
- request.once('aborted', instrumentedFinish)
191
+ response.once('close', instrumentedFinish)
192
192
 
193
193
  return tracer.bindFunction(emit, segment).apply(this, arguments)
194
194
  })
@@ -59,7 +59,8 @@ function normalizeQueryStringParameters(event) {
59
59
  }
60
60
 
61
61
  /**
62
- * normalizes headers either from multi value headers or normal headers to a
62
+ * Normalizes both request and response headers,
63
+ * either from Multi Value headers or "normal" headers to a
63
64
  * lowercase key map with comma separated string
64
65
  *
65
66
  * @param {object} event The event with headers to normalize
@@ -67,8 +68,14 @@ function normalizeQueryStringParameters(event) {
67
68
  * @returns {Object<string, string>} The normalized headers map
68
69
  */
69
70
  function normalizeHeaders(event, lowerCaseKey = false) {
71
+ const headers = event.multiValueHeaders ?? event.headers
72
+
73
+ if (!headers) {
74
+ return
75
+ }
76
+
70
77
  return Object.fromEntries(
71
- Object.entries(event.multiValueHeaders ?? event.headers).map(([headerKey, headerValue]) => {
78
+ Object.entries(headers).map(([headerKey, headerValue]) => {
72
79
  const newKey = lowerCaseKey ? headerKey.toLowerCase() : headerKey
73
80
 
74
81
  if (Array.isArray(headerValue)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "newrelic",
3
- "version": "9.10.0",
3
+ "version": "9.10.2",
4
4
  "author": "New Relic Node.js agent team <nodejs@newrelic.com>",
5
5
  "license": "Apache-2.0",
6
6
  "contributors": [
@@ -179,7 +179,7 @@
179
179
  "newrelic-naming-rules": "./bin/test-naming-rules.js"
180
180
  },
181
181
  "dependencies": {
182
- "@grpc/grpc-js": "^1.8.4",
182
+ "@grpc/grpc-js": "^1.8.7",
183
183
  "@grpc/proto-loader": "^0.7.4",
184
184
  "@newrelic/aws-sdk": "^5.0.2",
185
185
  "@newrelic/koa": "^7.1.1",