newrelic 10.4.2 → 10.5.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,17 @@
1
+ ### v10.5.0 (2023-07-20)
2
+
3
+ #### Features
4
+
5
+ * enabled code_level_metrics by default ([#1723](https://github.com/newrelic/node-newrelic/pull/1723)) ([0b96de3](https://github.com/newrelic/node-newrelic/commit/0b96de3fbf8db7be7d3673e29bab706d1d67de42))
6
+
7
+ #### Bug Fixes
8
+
9
+ * 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))
10
+
11
+ #### Miscellaneous Chores
12
+
13
+ * **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))
14
+
1
15
  ### v10.4.2 (2023-07-13)
2
16
 
3
17
  #### Bug Fixes
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)
@@ -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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "newrelic",
3
- "version": "10.4.2",
3
+ "version": "10.5.0",
4
4
  "author": "New Relic Node.js agent team <nodejs@newrelic.com>",
5
5
  "license": "Apache-2.0",
6
6
  "contributors": [