newrelic 10.4.2 → 10.6.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,29 @@
1
+ ### v10.6.0 (2023-07-26)
2
+
3
+ #### Miscellaneous Chores
4
+
5
+ * **deps:** Updated @newrelic/security-agent to v0.2.0 ([#1737](https://github.com/newrelic/node-newrelic/pull/1737)) ([9bf2a01](https://github.com/newrelic/node-newrelic/commit/9bf2a011aed846a024d6445f557eb8eb7d2e5efe))
6
+ * restored engines to >=14 until we actually drop support for Node 14 ([#1738](https://github.com/newrelic/node-newrelic/pull/1738)) ([8d66123](https://github.com/newrelic/node-newrelic/commit/8d66123105d25a3f949f0f5c2db53ecb7e9f2df0))
7
+
8
+ #### Continuous Integration
9
+
10
+ * Add Node.js 20.x to CI and remove 14.x ([#1603](https://github.com/newrelic/node-newrelic/pull/1603)) ([c4b008c](https://github.com/newrelic/node-newrelic/commit/c4b008c98c758ba3e669768a840e40dd8fe3e681))
11
+ * update support statement ([#1733](https://github.com/newrelic/node-newrelic/pull/1733)) ([3013da9](https://github.com/newrelic/node-newrelic/commit/3013da977ed6dae70bef81b1f1cf0dbf4acbb37b))
12
+
13
+ ### v10.5.0 (2023-07-20)
14
+
15
+ #### Features
16
+
17
+ * enabled code_level_metrics by default ([#1723](https://github.com/newrelic/node-newrelic/pull/1723)) ([0b96de3](https://github.com/newrelic/node-newrelic/commit/0b96de3fbf8db7be7d3673e29bab706d1d67de42))
18
+
19
+ #### Bug Fixes
20
+
21
+ * prevent ESM loader from loading instrumentation multiple times ([#1729](https://github.com/newrelic/node-newrelic/pull/1729)) ([962d172](https://github.com/newrelic/node-newrelic/commit/962d172aa5a9496041fe40e73ab8d183db94bae7))
22
+
23
+ #### Miscellaneous Chores
24
+
25
+ * **deps-dev:** bump word-wrap from 1.2.3 to 1.2.4 ([#1730](https://github.com/newrelic/node-newrelic/pull/1730)) ([500a69e](https://github.com/newrelic/node-newrelic/commit/500a69e6c9e94e4073805630e6d380f349d91689))
26
+
1
27
  ### v10.4.2 (2023-07-13)
2
28
 
3
29
  #### Bug Fixes
@@ -953,7 +953,7 @@ Apache License
953
953
 
954
954
  ### @newrelic/security-agent
955
955
 
956
- This product includes source derived from [@newrelic/security-agent](https://github.com/newrelic/csec-node-agent) ([v0.1.3](https://github.com/newrelic/csec-node-agent/tree/v0.1.3)), distributed under the [New Relic Pre-Release License](https://github.com/newrelic/csec-node-agent/blob/v0.1.3/LICENSE):
956
+ This product includes source derived from [@newrelic/security-agent](https://github.com/newrelic/csec-node-agent) ([v0.2.0](https://github.com/newrelic/csec-node-agent/tree/v0.2.0)), distributed under the [New Relic Pre-Release License](https://github.com/newrelic/csec-node-agent/blob/v0.2.0/LICENSE):
957
957
 
958
958
  ```
959
959
  ## New Relic Pre-Release Software Notice
package/esm-loader.mjs CHANGED
@@ -66,9 +66,16 @@ export async function resolve(specifier, context, nextResolve) {
66
66
  const { url, format } = resolvedModule
67
67
  logger.debug(`Instrumentation exists for ${specifier} ${format} package.`)
68
68
 
69
- if (format === 'commonjs') {
69
+ if (registeredSpecifiers.get(url)) {
70
+ logger.debug(
71
+ `Instrumentation already registered for ${specifier} under ${fileURLToPath(
72
+ url
73
+ )}, skipping resolve hook...`
74
+ )
75
+ } else if (format === 'commonjs') {
70
76
  // ES Modules translate import statements into fully qualified filepaths, so we create a copy of our instrumentation under this filepath
71
77
  const instrumentationDefinitionCopy = [...instrumentationDefinition]
78
+
72
79
  instrumentationDefinitionCopy.forEach((copy) => {
73
80
  // Stripping the prefix is necessary because the code downstream gets this url without it
74
81
  copy.moduleName = fileURLToPath(url)
@@ -80,6 +87,9 @@ export async function resolve(specifier, context, nextResolve) {
80
87
  `Registered CommonJS instrumentation for ${specifier} under ${copy.moduleName}`
81
88
  )
82
89
  })
90
+
91
+ // Keep track of what we've registered so we don't double register (see: https://github.com/newrelic/node-newrelic/issues/1646)
92
+ registeredSpecifiers.set(url, specifier)
83
93
  } else if (format === 'module') {
84
94
  registeredSpecifiers.set(url, specifier)
85
95
  const modifiedUrl = new URL(url)
package/index.js CHANGED
@@ -53,8 +53,8 @@ function initialize() {
53
53
  throw new Error(message)
54
54
  }
55
55
 
56
- // TODO: Update this check when Node v20 support is added
57
- if (psemver.satisfies('>=19.0.0')) {
56
+ // TODO: Update this check when Node v22 support is added
57
+ if (psemver.satisfies('>=21.0.0')) {
58
58
  logger.warn(
59
59
  'New Relic for Node.js %s has not been tested on Node.js %s. Please ' +
60
60
  'update the agent or downgrade your version of Node.js',
@@ -1221,7 +1221,7 @@ defaultConfig.definition = () => ({
1221
1221
  code_level_metrics: {
1222
1222
  enabled: {
1223
1223
  formatter: boolean,
1224
- default: false
1224
+ default: true
1225
1225
  }
1226
1226
  },
1227
1227
 
@@ -12,6 +12,7 @@ const logger = require('./logger').child({ component: 'environment' })
12
12
  const stringify = require('json-stringify-safe')
13
13
  const asyncEachLimit = require('./util/async-each-limit')
14
14
  const DISPATCHER_VERSION = 'Dispatcher Version'
15
+ const semver = require('semver')
15
16
 
16
17
  // As of 1.7.0 you can no longer dynamically link v8
17
18
  // https://github.com/nodejs/io.js/commit/d726a177ed
@@ -260,7 +261,7 @@ function flattenVersions(packages) {
260
261
  try {
261
262
  return stringify(pair)
262
263
  } catch (err) {
263
- logger.debug(err, 'Unabled to stringify package version')
264
+ logger.debug(err, 'Unable to stringify package version')
264
265
  return '<unknown>'
265
266
  }
266
267
  })
@@ -291,6 +292,19 @@ function remapConfigSettings() {
291
292
  addSetting(remapping[key], value)
292
293
  }
293
294
  })
295
+
296
+ maybeAddMissingProcessVars()
297
+ }
298
+ }
299
+
300
+ /**
301
+ * As of Node 19 DTrace and ETW are no longer bundled
302
+ * see: https://nodejs.org/en/blog/announcements/v19-release-announce#dtrace/systemtap/etw-support
303
+ */
304
+ function maybeAddMissingProcessVars() {
305
+ if (semver.gte(process.version, '19.0.0')) {
306
+ addSetting(remapping.node_use_dtrace, 'no')
307
+ addSetting(remapping.node_use_etw, 'no')
294
308
  }
295
309
  }
296
310
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "newrelic",
3
- "version": "10.4.2",
3
+ "version": "10.6.0",
4
4
  "author": "New Relic Node.js agent team <nodejs@newrelic.com>",
5
5
  "license": "Apache-2.0",
6
6
  "contributors": [
@@ -168,13 +168,11 @@
168
168
  "versioned-tests": "./bin/run-versioned-tests.sh",
169
169
  "update-changelog-version": "node ./bin/update-changelog-version",
170
170
  "checkout-external-versioned": "node ./test/versioned-external/checkout-external-tests.js",
171
- "versioned": "npm run versioned:npm7",
172
- "versioned:major": "VERSIONED_MODE=--major npm run versioned:npm7",
173
- "versioned:npm6": "npm run checkout-external-versioned && npm run prepare-test && time ./bin/run-versioned-tests.sh",
174
- "versioned:npm7": "npm run checkout-external-versioned && npm run prepare-test && NPM7=1 time ./bin/run-versioned-tests.sh",
175
- "versioned:async-local": "NEW_RELIC_FEATURE_FLAG_ASYNC_LOCAL_CONTEXT=1 npm run versioned:npm7",
171
+ "versioned:major": "VERSIONED_MODE=--major npm run versioned",
172
+ "versioned": "npm run checkout-external-versioned && npm run prepare-test && NPM7=1 time ./bin/run-versioned-tests.sh",
173
+ "versioned:async-local": "NEW_RELIC_FEATURE_FLAG_ASYNC_LOCAL_CONTEXT=1 npm run versioned",
176
174
  "versioned:async-local:major": "NEW_RELIC_FEATURE_FLAG_ASYNC_LOCAL_CONTEXT=1 npm run versioned:major",
177
- "versioned:security": "NEW_RELIC_SECURITY_AGENT_ENABLED=true npm run versioned:npm7",
175
+ "versioned:security": "NEW_RELIC_SECURITY_AGENT_ENABLED=true npm run versioned",
178
176
  "versioned:security:major": "NEW_RELIC_SECURITY_AGENT_ENABLED=true npm run versioned:major",
179
177
  "prepare": "husky install"
180
178
  },
@@ -187,7 +185,7 @@
187
185
  "@mrleebo/prisma-ast": "^0.5.2",
188
186
  "@newrelic/aws-sdk": "^6.0.0",
189
187
  "@newrelic/koa": "^7.1.1",
190
- "@newrelic/security-agent": "0.1.3",
188
+ "@newrelic/security-agent": "0.2.0",
191
189
  "@newrelic/superagent": "^6.0.0",
192
190
  "@tyriar/fibonacci-heap": "^2.0.7",
193
191
  "concat-stream": "^2.0.0",