Notes
⚠ BREAKING CHANGES
- Removed support for Node 14.
- Replaced ESM loader with import-in-the-middle to fix instrumentation firing for both CommonJS and ESM.
- You must load both the ESM loader and agent as follows:
node --experimental-loader newrelic/esm-loader.mjs -r newrelic path/to/app.js
. - Removed
config.esm.custom_instrumentation_entrypoint
to register ESM instrumentation. You can now just call thenewrelic.instrument*
APIs but you must pass in an object and specifyisEsm: true
. See example.
- You must load both the ESM loader and agent as follows:
- Updated agent to use require-in-the-middle to register CommonJS instrumentation. You can no longer use an onResolved hook to register custom instrumentation.
- Updated the default context manager to be AsyncLocalContextManager.
- Renamed
shim.handleCATHeaders
toshim.handleMqTracingHeaders
. - Updated agent to only run in the main thread. This is because running in a worker thread does not completely function out of the box. This will reduce the overhead for customers that are naively trying to load this into worker threads.
Features
- Added support for Node 20.
- Renamed
shim.handleCATHeaders
toshim.handleMqTracingHeaders
(#1735) (6788f9e)- If you have calls to
shim.handleCATHeaders
, the signature is identical and a function name change is only necessary. - Note: The agent will be removing CAT functionality in an upcoming release.
- If you have calls to
- Updated the default context manager to be AsyncLocalContextManager (#1731) (25f2bd8)
- To restore functionality of legacy context manager you can set
config.feature_flag.legacy_context_manager
totrue
or `NEW_RELIC_FEATURE_FLAG_LEGACY_CONTEXT_MANAGER=true - Please note this legacy context manager will be removed in future major releases. If you have any issues, please raise with New Relic support or on the issues of the agent.
- To restore functionality of legacy context manager you can set
Bug Fixes
- Replaced esm loader with import-in-the-middle to fix instrumentation firing for both commonjs and esm (#1760) (4452354), closes 1646
- Breaking Change: Updated ESM loader that now requires to use both a loader and -r.
node --experimental-loader newrelic/esm-loader.mjs -r newrelic path/to/app.js
- Breaking Change: Removed
config.esm.custom_instrumentation_entrypoint
to register ESM instrumentation.- You can now just call the
newrelic.instrument*
APIs but you must pass in an object and specifyisEsm: true
.
- You can now just call the
- Breaking Change: Updated ESM loader that now requires to use both a loader and -r.
- Updated prisma instrumentation to parse prisma datamodel with internal package (#1765) (48079b3)
Code Refactoring
- Updated agent to use require-in-the-middle to register CommonJS instrumentation (#1758) (d4b4f11)
- Removed onResolved hook. If you're using custom instrumentation with an onResolved hook, you must update to use onRequire
- You can no longer instrument files that are not within a node_module unless you provide an absolute path to the file when registering the instrumentation.
- You cannot instrument both the base module and a sub module.
Miscellaneous Chores
- Remove support for Node 14 (#1756) (0ff9912)
- Updated the bundled packages to the latest
@newrelic/superagent
,@newrelic/aws-sdk
,@newrelic/koa
,@newrelic/native-metrics
, and@newrelic/test-utilities
(#1766) (8f6e15b) - Updated the aws-sdk external branch to be main now that the code is in there (#1761) (d34d0fe)
Tests
Support statement:
We recommend updating to the latest agent version as soon as it's available. If you can't upgrade to the latest version, update your agents to a version no more than 90 days old. Read more about keeping agents up to date. (https://docs.newrelic.com/docs/new-relic-solutions/new-relic-one/install-configure/update-new-relic-agent/)
See the New Relic Node.js agent EOL policy for information about agent releases and support dates. (https://docs.newrelic.com/docs/apm/agents/nodejs-agent/getting-started/nodejs-agent-eol-policy/)