newrelic 9.14.0 → 9.14.1

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,7 @@
1
+ ### v9.14.1 (2023-03-23)
2
+
3
+ * Restored assigning loaded version of agent to require.cache as `__NR_cache` instead of a symbol to properly detect attempts at loading agent twice.
4
+
1
5
  ### v9.14.0 (2023-03-23)
2
6
 
3
7
  * Added new API function called `setErrorGroupCallback`, which provides a way for you to customize the `error.group.name` attribute of errors that are captured by the agent. This attribute controls how the Errors Inbox functionality groups similar errors together. To learn more about this function, please refer to our [example app](https://github.com/newrelic/newrelic-node-examples).
package/index.js CHANGED
@@ -14,7 +14,6 @@ require('./lib/util/unwrapped-core')
14
14
 
15
15
  const featureFlags = require('./lib/feature_flags').prerelease
16
16
  const psemver = require('./lib/util/process-version')
17
- const symbols = require('./lib/symbols')
18
17
  let logger = require('./lib/logger') // Gets re-loaded after initialization.
19
18
 
20
19
  const pkgJSON = require('./package.json')
@@ -24,15 +23,15 @@ logger.info(
24
23
  process.version
25
24
  )
26
25
 
27
- if (require.cache[symbols.cache]) {
26
+ if (require.cache.__NR_cache) {
28
27
  logger.warn(
29
28
  'Attempting to load a second copy of newrelic from %s, using cache instead',
30
29
  __dirname
31
30
  )
32
- if (require.cache[symbols.cache].agent) {
33
- require.cache[symbols.cache].agent.recordSupportability('Agent/DoubleLoad')
31
+ if (require.cache.__NR_cache.agent) {
32
+ require.cache.__NR_cache.agent.recordSupportability('Agent/DoubleLoad')
34
33
  }
35
- module.exports = require.cache[symbols.cache]
34
+ module.exports = require.cache.__NR_cache
36
35
  } else {
37
36
  initialize()
38
37
  }
@@ -99,7 +98,7 @@ function initialize() {
99
98
  API = require('./stub_api')
100
99
  }
101
100
 
102
- require.cache[symbols.cache] = module.exports = new API(agent)
101
+ require.cache.__NR_cache = module.exports = new API(agent)
103
102
 
104
103
  // If we loaded an agent, record a startup time for the agent.
105
104
  // NOTE: Metrics are recorded in seconds, so divide the value by 1000.
package/lib/symbols.js CHANGED
@@ -6,7 +6,6 @@
6
6
  'use strict'
7
7
 
8
8
  module.exports = {
9
- cache: Symbol('cache'),
10
9
  clm: Symbol('codeLevelMetrics'),
11
10
  context: Symbol('context'),
12
11
  databaseName: Symbol('databaseName'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "newrelic",
3
- "version": "9.14.0",
3
+ "version": "9.14.1",
4
4
  "author": "New Relic Node.js agent team <nodejs@newrelic.com>",
5
5
  "license": "Apache-2.0",
6
6
  "contributors": [