newrelic 12.8.2 → 12.9.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 CHANGED
@@ -1,3 +1,24 @@
1
+ ### v12.9.0 (2024-12-18)
2
+
3
+ #### Features
4
+
5
+ * Added entity linking attributes to aws-sdk v3 Lambda segments ([#2845](https://github.com/newrelic/node-newrelic/pull/2845)) ([8820265](https://github.com/newrelic/node-newrelic/commit/882026502dbc12b700b893485458176bcd03f68e))
6
+ * Provided ability to define newrelic config as `newrelic.mjs` ([#2836](https://github.com/newrelic/node-newrelic/pull/2836)) ([972b59d](https://github.com/newrelic/node-newrelic/commit/972b59d4c4bd5f212d5fd695ce1007802354b7a0))
7
+
8
+ #### Documentation
9
+
10
+ * Updated compatibility report ([#2828](https://github.com/newrelic/node-newrelic/pull/2828)) ([d5fe8e3](https://github.com/newrelic/node-newrelic/commit/d5fe8e323c34464e8cc10be3f5c968a96357b6f6))
11
+
12
+ #### Miscellaneous chores
13
+
14
+ * **deps:** Updated @newrelic/security-agent to v2.2.0 ([#2842](https://github.com/newrelic/node-newrelic/pull/2842)) ([170941e](https://github.com/newrelic/node-newrelic/commit/170941e2f16d7e84edabfff40fd31906612b393e))
15
+ * Updated borp configs to target tests correctly ([#2835](https://github.com/newrelic/node-newrelic/pull/2835)) ([66ae59d](https://github.com/newrelic/node-newrelic/commit/66ae59d1e047dead092b3fa681017e3d42ce9474))
16
+
17
+ #### Tests
18
+
19
+ * Removed `tap` and cleaned up left over tap helpers ([#2804](https://github.com/newrelic/node-newrelic/pull/2804)) ([37407b6](https://github.com/newrelic/node-newrelic/commit/37407b6d14c2bd6a1c577cce811277753eb8069e))
20
+ * Updated `match` to fail if you pass in an object that lacks the expected keys ([#2843](https://github.com/newrelic/node-newrelic/pull/2843)) ([a3db8bd](https://github.com/newrelic/node-newrelic/commit/a3db8bd993d82a3c1c8873f9e552ba5fdf7cb5f4))
21
+
1
22
  ### v12.8.2 (2024-12-09)
2
23
 
3
24
  #### Bug fixes
@@ -74,7 +74,6 @@ code, the source code can be found at [https://github.com/newrelic/node-newrelic
74
74
  * [should](#should)
75
75
  * [sinon](#sinon)
76
76
  * [superagent](#superagent)
77
- * [tap](#tap)
78
77
 
79
78
  **[optionalDependencies](#optionalDependencies)**
80
79
 
@@ -509,7 +508,7 @@ This product includes source derived from [@grpc/proto-loader](https://github.co
509
508
 
510
509
  ### @newrelic/security-agent
511
510
 
512
- This product includes source derived from [@newrelic/security-agent](https://github.com/newrelic/csec-node-agent) ([v2.0.0](https://github.com/newrelic/csec-node-agent/tree/v2.0.0)), distributed under the [UNKNOWN License](https://github.com/newrelic/csec-node-agent/blob/v2.0.0/LICENSE):
511
+ This product includes source derived from [@newrelic/security-agent](https://github.com/newrelic/csec-node-agent) ([v2.2.0](https://github.com/newrelic/csec-node-agent/tree/v2.2.0)), distributed under the [UNKNOWN License](https://github.com/newrelic/csec-node-agent/blob/v2.2.0/LICENSE):
513
512
 
514
513
  ```
515
514
  ## New Relic Software License v1.0
@@ -1041,7 +1040,7 @@ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1041
1040
 
1042
1041
  ### winston-transport
1043
1042
 
1044
- This product includes source derived from [winston-transport](https://github.com/winstonjs/winston-transport) ([v4.7.1](https://github.com/winstonjs/winston-transport/tree/v4.7.1)), distributed under the [MIT License](https://github.com/winstonjs/winston-transport/blob/v4.7.1/LICENSE):
1043
+ This product includes source derived from [winston-transport](https://github.com/winstonjs/winston-transport) ([v4.8.0](https://github.com/winstonjs/winston-transport/tree/v4.8.0)), distributed under the [MIT License](https://github.com/winstonjs/winston-transport/blob/v4.8.0/LICENSE):
1045
1044
 
1046
1045
  ```
1047
1046
  The MIT License (MIT)
@@ -1074,7 +1073,7 @@ SOFTWARE.
1074
1073
 
1075
1074
  ### @aws-sdk/client-s3
1076
1075
 
1077
- This product includes source derived from [@aws-sdk/client-s3](https://github.com/aws/aws-sdk-js-v3) ([v3.621.0](https://github.com/aws/aws-sdk-js-v3/tree/v3.621.0)), distributed under the [Apache-2.0 License](https://github.com/aws/aws-sdk-js-v3/blob/v3.621.0/LICENSE):
1076
+ This product includes source derived from [@aws-sdk/client-s3](https://github.com/aws/aws-sdk-js-v3) ([v3.668.0](https://github.com/aws/aws-sdk-js-v3/tree/v3.668.0)), distributed under the [Apache-2.0 License](https://github.com/aws/aws-sdk-js-v3/blob/v3.668.0/LICENSE):
1078
1077
 
1079
1078
  ```
1080
1079
  Apache License
@@ -1283,7 +1282,7 @@ This product includes source derived from [@aws-sdk/client-s3](https://github.co
1283
1282
 
1284
1283
  ### @aws-sdk/s3-request-presigner
1285
1284
 
1286
- This product includes source derived from [@aws-sdk/s3-request-presigner](https://github.com/aws/aws-sdk-js-v3) ([v3.621.0](https://github.com/aws/aws-sdk-js-v3/tree/v3.621.0)), distributed under the [Apache-2.0 License](https://github.com/aws/aws-sdk-js-v3/blob/v3.621.0/LICENSE):
1285
+ This product includes source derived from [@aws-sdk/s3-request-presigner](https://github.com/aws/aws-sdk-js-v3) ([v3.668.0](https://github.com/aws/aws-sdk-js-v3/tree/v3.668.0)), distributed under the [Apache-2.0 License](https://github.com/aws/aws-sdk-js-v3/blob/v3.668.0/LICENSE):
1287
1286
 
1288
1287
  ```
1289
1288
  Apache License
@@ -1492,7 +1491,7 @@ This product includes source derived from [@aws-sdk/s3-request-presigner](https:
1492
1491
 
1493
1492
  ### @koa/router
1494
1493
 
1495
- 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):
1494
+ 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):
1496
1495
 
1497
1496
  ```
1498
1497
  The MIT License (MIT)
@@ -2206,7 +2205,7 @@ THE SOFTWARE.
2206
2205
 
2207
2206
  ### @slack/bolt
2208
2207
 
2209
- This product includes source derived from [@slack/bolt](https://github.com/slackapi/bolt) ([v3.19.0](https://github.com/slackapi/bolt/tree/v3.19.0)), distributed under the [MIT License](https://github.com/slackapi/bolt/blob/v3.19.0/LICENSE):
2208
+ This product includes source derived from [@slack/bolt](https://github.com/slackapi/bolt) ([v3.22.0](https://github.com/slackapi/bolt/tree/v3.22.0)), distributed under the [MIT License](https://github.com/slackapi/bolt/blob/v3.22.0/LICENSE):
2210
2209
 
2211
2210
  ```
2212
2211
  The MIT License (MIT)
@@ -2683,7 +2682,7 @@ SOFTWARE.
2683
2682
 
2684
2683
  ### async
2685
2684
 
2686
- This product includes source derived from [async](https://github.com/caolan/async) ([v3.2.5](https://github.com/caolan/async/tree/v3.2.5)), distributed under the [MIT License](https://github.com/caolan/async/blob/v3.2.5/LICENSE):
2685
+ This product includes source derived from [async](https://github.com/caolan/async) ([v3.2.6](https://github.com/caolan/async/tree/v3.2.6)), distributed under the [MIT License](https://github.com/caolan/async/blob/v3.2.6/LICENSE):
2687
2686
 
2688
2687
  ```
2689
2688
  Copyright (c) 2010-2018 Caolan McMahon
@@ -2710,7 +2709,7 @@ THE SOFTWARE.
2710
2709
 
2711
2710
  ### aws-sdk
2712
2711
 
2713
- This product includes source derived from [aws-sdk](https://github.com/aws/aws-sdk-js) ([v2.1665.0](https://github.com/aws/aws-sdk-js/tree/v2.1665.0)), distributed under the [Apache-2.0 License](https://github.com/aws/aws-sdk-js/blob/v2.1665.0/LICENSE.txt):
2712
+ This product includes source derived from [aws-sdk](https://github.com/aws/aws-sdk-js) ([v2.1691.0](https://github.com/aws/aws-sdk-js/tree/v2.1691.0)), distributed under the [Apache-2.0 License](https://github.com/aws/aws-sdk-js/blob/v2.1691.0/LICENSE.txt):
2714
2713
 
2715
2714
  ```
2716
2715
 
@@ -3138,7 +3137,7 @@ THE SOFTWARE.
3138
3137
 
3139
3138
  ### eslint-plugin-jsdoc
3140
3139
 
3141
- This product includes source derived from [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) ([v48.10.2](https://github.com/gajus/eslint-plugin-jsdoc/tree/v48.10.2)), distributed under the [BSD-3-Clause License](https://github.com/gajus/eslint-plugin-jsdoc/blob/v48.10.2/LICENSE):
3140
+ This product includes source derived from [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) ([v48.11.0](https://github.com/gajus/eslint-plugin-jsdoc/tree/v48.11.0)), distributed under the [BSD-3-Clause License](https://github.com/gajus/eslint-plugin-jsdoc/blob/v48.11.0/LICENSE):
3142
3141
 
3143
3142
  ```
3144
3143
  Copyright (c) 2018, Gajus Kuizinas (http://gajus.com/)
@@ -3343,7 +3342,7 @@ Library.
3343
3342
 
3344
3343
  ### eslint
3345
3344
 
3346
- This product includes source derived from [eslint](https://github.com/eslint/eslint) ([v8.57.0](https://github.com/eslint/eslint/tree/v8.57.0)), distributed under the [MIT License](https://github.com/eslint/eslint/blob/v8.57.0/LICENSE):
3345
+ This product includes source derived from [eslint](https://github.com/eslint/eslint) ([v8.57.1](https://github.com/eslint/eslint/tree/v8.57.1)), distributed under the [MIT License](https://github.com/eslint/eslint/blob/v8.57.1/LICENSE):
3347
3346
 
3348
3347
  ```
3349
3348
  Copyright OpenJS Foundation and other contributors, <www.openjsf.org>
@@ -3370,7 +3369,7 @@ THE SOFTWARE.
3370
3369
 
3371
3370
  ### express
3372
3371
 
3373
- This product includes source derived from [express](https://github.com/expressjs/express) ([v4.19.2](https://github.com/expressjs/express/tree/v4.19.2)), distributed under the [MIT License](https://github.com/expressjs/express/blob/v4.19.2/LICENSE):
3372
+ This product includes source derived from [express](https://github.com/expressjs/express) ([v4.21.1](https://github.com/expressjs/express/tree/v4.21.1)), distributed under the [MIT License](https://github.com/expressjs/express/blob/v4.21.1/LICENSE):
3374
3373
 
3375
3374
  ```
3376
3375
  (The MIT License)
@@ -4001,7 +4000,7 @@ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
4001
4000
 
4002
4001
  ### self-cert
4003
4002
 
4004
- This product includes source derived from [self-cert](https://github.com/jsumners/self-cert) ([v2.0.0](https://github.com/jsumners/self-cert/tree/v2.0.0)), distributed under the [MIT License](https://github.com/jsumners/self-cert/blob/v2.0.0/Readme.md):
4003
+ This product includes source derived from [self-cert](https://github.com/jsumners/self-cert) ([v2.0.1](https://github.com/jsumners/self-cert/tree/v2.0.1)), distributed under the [MIT License](https://github.com/jsumners/self-cert/blob/v2.0.1/Readme.md):
4005
4004
 
4006
4005
  ```
4007
4006
  MIT License
@@ -4108,29 +4107,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
4108
4107
 
4109
4108
  ```
4110
4109
 
4111
- ### tap
4112
-
4113
- This product includes source derived from [tap](https://github.com/tapjs/node-tap) ([v16.3.10](https://github.com/tapjs/node-tap/tree/v16.3.10)), distributed under the [ISC License](https://github.com/tapjs/node-tap/blob/v16.3.10/LICENSE):
4114
-
4115
- ```
4116
- The ISC License
4117
-
4118
- Copyright (c) 2011-2023 Isaac Z. Schlueter and Contributors
4119
-
4120
- Permission to use, copy, modify, and/or distribute this software for any
4121
- purpose with or without fee is hereby granted, provided that the above
4122
- copyright notice and this permission notice appear in all copies.
4123
-
4124
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
4125
- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
4126
- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
4127
- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
4128
- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
4129
- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
4130
- IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
4131
-
4132
- ```
4133
-
4134
4110
 
4135
4111
  ## optionalDependencies
4136
4112
 
@@ -45,7 +45,9 @@ let logger = null // Lazy-loaded in `initialize`.
45
45
  let _configInstance = null
46
46
 
47
47
  const getConfigFileNames = () =>
48
- [process.env.NEW_RELIC_CONFIG_FILENAME, 'newrelic.js', 'newrelic.cjs'].filter(Boolean)
48
+ [process.env.NEW_RELIC_CONFIG_FILENAME, 'newrelic.js', 'newrelic.cjs', 'newrelic.mjs'].filter(
49
+ Boolean
50
+ )
49
51
 
50
52
  const getConfigFileLocations = () =>
51
53
  [
@@ -0,0 +1,57 @@
1
+ /*
2
+ * Copyright 2021 New Relic Corporation. All rights reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+
6
+ 'use strict'
7
+ const InstrumentationDescriptor = require('../../../instrumentation-descriptor')
8
+
9
+ /**
10
+ * Defines a deserialize middleware to add the
11
+ * cloud.resource_id segment attributes for the AWS command
12
+ *
13
+ * @param {Shim} shim New Relic agent shim
14
+ * @param {Object} config AWS command configuration
15
+ * @param {function} next next function in middleware chain
16
+ * @returns {function} wrapped version of middleware function
17
+ */
18
+ function resourceIdMiddleware(shim, config, next) {
19
+ return async function wrappedResourceIdMiddleware(args) {
20
+ let result
21
+ try {
22
+ const region = await config.region()
23
+ result = await next(args)
24
+ const { response } = result
25
+ const segment = shim.getSegment(response.body.req)
26
+ // We can't derive account ID, so we have to consume it from config
27
+ const accountId = shim.agent.config.cloud.aws.account_id
28
+ const functionName = args?.input?.FunctionName // have to get function from params
29
+ if (accountId && functionName) {
30
+ segment.addAttribute(
31
+ 'cloud.resource_id',
32
+ `arn:aws:lambda:${region}:${accountId}:function:${functionName}`
33
+ )
34
+ segment.addAttribute('cloud.platform', `aws_lambda`)
35
+ }
36
+ } catch (err) {
37
+ shim.logger.debug(err, 'Failed to add AWS cloud resource id to segment')
38
+ } finally {
39
+ return result
40
+ }
41
+ }
42
+ }
43
+
44
+ const lambdaMiddlewareConfig = {
45
+ middleware: resourceIdMiddleware,
46
+ type: InstrumentationDescriptor.TYPE_GENERIC,
47
+ config: {
48
+ name: 'NewRelicGetResourceId',
49
+ step: 'deserialize',
50
+ priority: 'low',
51
+ override: true
52
+ }
53
+ }
54
+
55
+ module.exports = {
56
+ lambdaMiddlewareConfig
57
+ }
@@ -9,12 +9,14 @@ const { middlewareConfig } = require('./common')
9
9
  const { snsMiddlewareConfig } = require('./sns')
10
10
  const { sqsMiddlewareConfig } = require('./sqs')
11
11
  const { dynamoMiddlewareConfig } = require('./dynamodb')
12
+ const { lambdaMiddlewareConfig } = require('./lambda')
12
13
  const { bedrockMiddlewareConfig } = require('./bedrock')
13
14
  const MIDDLEWARE = Symbol('nrMiddleware')
14
15
 
15
16
  const middlewareByClient = {
16
17
  Client: middlewareConfig,
17
18
  BedrockRuntime: [...middlewareConfig, bedrockMiddlewareConfig],
19
+ Lambda: [...middlewareConfig, lambdaMiddlewareConfig],
18
20
  SNS: [...middlewareConfig, snsMiddlewareConfig],
19
21
  SQS: [...middlewareConfig, sqsMiddlewareConfig],
20
22
  DynamoDB: [...middlewareConfig, ...dynamoMiddlewareConfig],
@@ -249,9 +249,7 @@ class AwsLambda {
249
249
  _getAwsAgentAttributes(event, context) {
250
250
  const attributes = {
251
251
  'aws.lambda.arn': context.invokedFunctionArn,
252
- 'aws.requestId': context.awsRequestId,
253
- 'cloud.resource_id': context.invokedFunctionArn,
254
- 'cloud.platform': 'aws_lambda'
252
+ 'aws.requestId': context.awsRequestId
255
253
  }
256
254
 
257
255
  const eventSourceInfo = this._detectEventType(event)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "newrelic",
3
- "version": "12.8.2",
3
+ "version": "12.9.0",
4
4
  "author": "New Relic Node.js agent team <nodejs@newrelic.com>",
5
5
  "license": "Apache-2.0",
6
6
  "contributors": [
@@ -161,7 +161,7 @@
161
161
  "bench": "node ./bin/run-bench.js",
162
162
  "docker-env": "./bin/docker-env-vars.sh",
163
163
  "docs": "rm -rf ./out && jsdoc -c ./jsdoc-conf.jsonc --private -r .",
164
- "integration": "npm run prepare-test && npm run sub-install && BORP_CONF_FILE=.borp.int.yaml time c8 -o ./coverage/integration borp --timeout 600000 --reporter ./test/lib/test-reporter.mjs",
164
+ "integration": "npm run sub-install && BORP_CONF_FILE=.borp.int.yaml time c8 -o ./coverage/integration borp --timeout 600000 --reporter ./test/lib/test-reporter.mjs",
165
165
  "integration:esm": "NODE_OPTIONS='--loader=./esm-loader.mjs' BORP_CONF_FILE=.borp.int-esm.yaml time c8 -o ./coverage/integration-esm borp --reporter ./test/lib/test-reporter.mjs",
166
166
  "prepare-test": "npm run docker-env",
167
167
  "lint": "eslint ./*.{js,mjs} lib test bin",
@@ -196,7 +196,7 @@
196
196
  "dependencies": {
197
197
  "@grpc/grpc-js": "^1.12.2",
198
198
  "@grpc/proto-loader": "^0.7.5",
199
- "@newrelic/security-agent": "^2.0.0",
199
+ "@newrelic/security-agent": "^2.2.0",
200
200
  "@tyriar/fibonacci-heap": "^2.0.7",
201
201
  "concat-stream": "^2.0.0",
202
202
  "https-proxy-agent": "^7.0.1",
@@ -257,8 +257,7 @@
257
257
  "self-cert": "^2.0.0",
258
258
  "should": "*",
259
259
  "sinon": "^5.1.1",
260
- "superagent": "^9.0.1",
261
- "tap": "^16.3.4"
260
+ "superagent": "^9.0.1"
262
261
  },
263
262
  "repository": {
264
263
  "type": "git",