Node.js release notes

Node.js agent release notes

Tuesday, September 13, 2016 - 15:20 Download


This release has been unpublished from Please use version 1.30.3 or higher.

New features

  • Added instrumentation of the param() function in Express.

    The agent will now create metrics and transaction segments when the Express param() function is called as a part of a route. This also fixes an issue with transaction naming when the HTTP response is ended within a param() method.

Bug fixes

  • Fixed an issue with naming Express transactions that result in 404 errors.

    Previously transactions were not always correctly normalized for URLs that caused 404 errors. The transactions will now always be reported with the same normalized name (e.g. "get /").

  • Fixed instrumentation of Express v4.0 - v4.5.

    Previously transactions were not correctly named on older versions of Express 4.


  • Minor upates to logging.
Thursday, September 1, 2016 - 15:00 Download

Bug fixes

  • The shutdown method is now on the stub API.

    Previously when the agent was disabled the stub API passed back on require did not have the shutdown method. Thanks goes to Vlad Fedosov (@StyleT) for this contribution!

  • Global timers will now be wrapped correctly regardless of being wrapped by something else.

    The logic to check whether to wrap the global timers was looking to see if the global timers were the same function reference as the ones in the timers module. This would break in cases where either the global or timers functions had been wrapped.

  • Director instrumentation now correctly handles the case of null route handlers being passed in.

    Previously the agent's director instrumentation would crash in cases of null route handlers in director.

Monday, August 29, 2016 - 15:28 Download


You must read and agree to the Beta Agreement before using this beta version of the agent.

New features

  • Added rowCallback property to datastore segment descriptors.

    With this parameter the shim will record the given function/parameter as a per-row callback which may be called multiple times. These calls will be counted up for traces.


  • Incorporated fixes from v1.30.0

  • Rewrote PostgreSQL instrumentation using new DatastoreShim class.

  • Reversed reverse_naming_rules default.

    Naming rules now default to evaluating in forward order.

Thursday, August 25, 2016 - 14:12 Download

New features

  • A number of improvements and fixes to transaction naming rules.

    Added attributes terminate_chain, replace_all, and precedence to allow more control over how naming rules are executed. Please see the updated documentation in our README file.

    The order in which naming rules are executed can now be reversed with a feature flag reverse_naming_rules.

    When applying naming rules, the regular expression matching is now case insensitive.

    We have added a tool for testing naming rules. When the agent is installed, the tool can be run in terminal by executing node node_modules/.bin/newrelic-naming-rules.

    We have also improved our trace logging around transaction naming.


  • Added trace logging to track number of transactions and segments in progress, and to better track segments created with the Express instrumentation.

  • Fixed mysql2 tests that were not being run correctly.

Bug fixes

  • Fixed issue with reporting errors from domains.

    When an error is handled by using the error event of the domain, it is no longer reported as an uncaught exception.

Thursday, August 4, 2016 - 14:30 Download


You must read and agree to the Beta Agreement before using this beta version of the agent.

Dropped support for Node.js 0.6 and 0.8 as well as node-mysql package versions < 1.0.0.

New features

  • Improved API for writing instrumentation.

    Introduced new classes for writing instrumentation, Shim and DatastoreShim. These classes along with the new newrelic.instrument and newrelic.instrumentDatastore methods make writing 3rd party instrumentation much easier.

  • Rewrote instrumentation for Cassandra, Redis, ioredis, MySQL, and MongoDB.

    These instrumentations were rewritten using the new DatastoreShim interface. Their functionality is largely unchanged but the new code should be easier to maintain and extend.

  • Added public API documentation.

    Documentation for the New Relic agent API has been generated using JSDoc and is now hosted on GitHub at There you can find documentation on the new classes as well as the pre-existing API methods.

Thursday, July 14, 2016 - 15:00 Download


  • Domain error handlers will now be scoped to the transaction the error occurred in.

    Previously, the 'error' event handlers would not be scoped to a transaction causing our API methods to not associate data correctly (e.g. using noticeError would not associate the error with the transaction and would instead be unscoped).

Bug fixes

  • Reworked the SQL parser to handle new lines in the query.

    Previously the agent would have difficulty classifying queries with new lines in them. Thanks to Libin Lu (@evollu) for the fix!

  • Postgres instrumentation is now compatible with inputs with text getter attributes.

    Thanks again to Libin Lu (@evollu) for the fix!

Thursday, July 14, 2016 - 14:19 Download


  • Improved agent startup speed by ~10% by simplifying environment checks.

    Removed prolific fs.exists and fs.stat checks, instead simply handling the error for mis-used files which greatly reduces disk access.

  • Added slightly more trace-level logging around the creation of segments.

  • Added examples for using the newrelic.createBackgroundTransaction method in a number of different use cases.

Bug fixes

  • Removed excessive segment creation from PG instrumentation.

    For queries with many results we would create a segment for each result. This would result in excessive object allocation and then cause harsh GC thrashing.

  • Fixed a bug in agent connect that could cause an identity crisis under specific use cases.

    When using the agent with multiple app names, transaction information could be misattributed to other services if they share the same first app name. This resolves that by using all of the host names to uniquely identify the agent.

Thursday, July 7, 2016 - 14:00 Download


  • Director instrumentation that will now name the transaction correctly, as well as create segments corresponding to the handlers registered with director.

  • Transaction naming refactor - this should clear up some inconsistent naming issues in our router instrumentations.

    Previously the instrumentation was tasked with the maintenance of the transaction state name, now this has been abstracted into its own class to be used by instrumentations.

  • Express instrumentation refactored to scope transaction storage to the incoming request object.

    Previously the express instrumentation used a stack to track which router was expecting middleware to finish and keep track of which transaction is being executed. The new implementation has a stronger guarantee on scoping work to the correct transaction.

Bug fixes

  • The agent now uses the correct units (was seconds, now milliseconds) for slow queries - this fixes and issue where query traces in the databases tab were slower than the reported maximum.
Wednesday, June 15, 2016 - 11:00 Download


  • The following attributes are now sent to Insights along with transaction events: databaseDuration, databaseCallCount.

  • Updated Redis instrumentation to work with version 2.x of the redis module.

  • Improvements to error tracking on systems that have a lot of errors.

  • Minor improvements in tests and logging.

Bug fixes

  • Fixed a few issues with the Express instrumentation.

    Middleware functions mounted with a path variable now generate the correct middleware metrics. Routers mounted using route methods now generate the correct trace segments and times. Routers mounted on root path are now not included in trace when they contain no matching routes.

Wednesday, May 25, 2016 - 14:27 Download

New features

  • Express middleware metrics are now enabled by default.


  • The following attributes are now sent to Insights along with transaction events: externalDuration, externalCallCount, and queueDuration.

  • Custom SSL certificates (from the agent configuration) are now used even when a proxy is not explicitly defined. This is useful in some environments that use an implicit proxy for all network traffic.

Thursday, May 5, 2016 - 14:00 Download

Bug fixes

  • Fixed duplicated external transactions for https requests in Node > 0.10.

    Any external transaction that used the https module to make the request would appear twice in transaction traces due to https.request internally using http.request. This has now been resolved.

  • Updated eslint dev dependency to 2.9.0 (was 0.24.1).

  • Fixed an issue with transaction naming precedence.

    Custom naming of transactions will no longer be replaced by names generated by the instrumentation.

  • Fixed tests which broke under Node 6.0.

    Node 6.0.0 changed some messaging and internal functionality which our tests were asserting on. These tests have been updated to work with either the new version or the older ones.

  • Fixed installing GCC 5 in Travis for testing native modules in Node >= 3.0.

    Starting in Node 3.0, native modules were compiled with C++11 features enabled. The version of GCC preinstalled on Travis was too old to support that so we now manually install GCC 5 and set it as the system compiler.

  • Fixed metrics that were being scoped to themselves.

    Some metrics were scoped to themselves, causing a strange visual glitch in the New Relic UI. This self-scoping has been removed.

  • Added tests for transaction naming with parallel requests in Express.

Tuesday, May 3, 2016 - 11:12 Download

Bug fixes

  • Fixed issue with checking listener count for uncaughtException and unhandledRejection global events.

  • Fixed a number of issues with promise instrumentation of Bluebird.

Thursday, April 21, 2016 - 14:30 Download


This release has been unpublished from Use version 1.27.1 or higher.

New Features

  • Reworked promise instrumentation to be more reliable and reusable.

    Promise instrumentation has been rewritten to be applicable to any A+ compliant promise library. This change brings more consistent instrumentation of Bluebird promises.

    This change also allows users to see the execution order of chained promises in their Transaction Traces. This is an opt-in process and can be achieved by setting feature_flag.promise_segments to true in the agent config.

Bug fixes

  • The agent now properly checks for custom SSL certificates.

    The check previously was falsely positive if there was an empty list of custom certificates. This caused red herrings to be admitted into the debug logs. Thanks to Seth Shober (@sethshober) for the fix!

  • Promise error handling is now more consistent.

    Previously the agent would notice errors being emitted on unhandledRejection regardless of other listeners. Errors coming in on the unhandledRejection event will not be recorded if there are handlers for the event - this is more in line with our error handling practices in other instrumentations.


  • Added a .npmignore file to exclude non-essential files.

    The agent will now omit tests and examples on install from npm, drastically improving download times. Thanks to Serge Havas (@Sinewyk) for the contribution!

  • Logging has been reworked to reduce CPU overhead.

    The check to see if a logging call was valid happened fairly late in the logic, causing unnecessary work to be done regardless of logger state. This has been rectified, netting a large decrease in CPU overhead.

Thursday, April 7, 2016 - 11:00 Download

New features

  • Added ioredis instrumentation.

    Big thanks to Guilherme Souza (@guilhermef) for the contribution!

  • Added a new shutdown call to the public API.

    Thanks to @echmykhun for the contribution!

    The new shutdown API call will gracefully stop the agent. It can optionally harvest any pending data waiting to be sent to the New Relic servers before shutting down.

    To read more about this new API, please read our README, or visit our docs page.

  • Added support for truncated segment notifiers.

    Segments related to work that happens after a transaction has finished will now be labeled as Truncated in the UI.

Bug fixes

  • Fixed an issue in the express instrumentation related to inactive/lost transaction state.

    Thanks to Jacob Page (@DullReferenceException) for submitting this fix.

    Previously, the agent would crash if there was no active transaction when an Express middleware would handle the request.


  • The agent now uses MongoDB's APM API for its instrumentation.

    Method discovery for instrumentation is now done through MongoDB's APM API in newer versions of the MongoDB driver.

Thursday, March 31, 2016 - 11:00 Download

New features

  • Added capturing errors from the unhandledRejection global event.

    If a promise is rejected with an error, and the error is not handled, the error will now be reported to New Relic.

Bug fixes

  • Fixed issue with attaching an event handler every time Express was required.

  • Fixed issue with chained promises losing context.

    Previously the transaction state was getting lost when an error was thrown early in a promise chain.

  • Fixed issue with the agent crashing when an http Server did not have the address() getter.

  • Fixed issue with Express instrumentation when a wrapped layer object was missing a method.


  • Added more logging around the CAT feature.
Wednesday, March 23, 2016 - 14:15 Download


Express instrumentation has been fundamentally reworked.

This refactor includes a few bug fixes around error handling and transaction naming, as well as optional higher resolution traces.

Setting feature_flag.express_segments to true in the agent config will make the agent report the amount of time spent in each individual middleware per request


The agent will not report errors handled in an error handler it is monitoring - this is more in line with how the agent does error handling in other contexts.

The agent will now name transactions correctly when an application responds from a middleware.

Wednesday, March 9, 2016 - 11:15 Download


  • Added instrumentation of Bluebird promises.

    Previously, the transaction state could get lost when multiple promises resolved close to each other.

  • Fixed issue with PostgreSQL native instrumentation.

    Previously, calling require('pg').native more than once was causing the agent to crash.

  • Fixed issue with hapi instrumentation not returning value from Server.connection().

  • Various improvements to tests to make them more stable.

Wednesday, February 24, 2016 - 14:14 Download

New features

  • Added more HTTP request/response parameters to transactions.

    The agent now collects additional request/response HTTP headers (e.g. contentType, HTTP method, response status code). These can be used to filter and group errors in the Error analytics page, as well as events in Insights.


  • Fixed an issue with collecting errors when an Express error handler removed message and stack properties from the error object.
Thursday, February 18, 2016 - 10:00 Download


  • Fixed crashing bug on unhandled rejections in Q.

    Previously, the agent would cause the process to crash in the event of an unhandled rejection.

    Thanks to @mdlavin for this fix!

Wednesday, February 17, 2016 - 14:00 Download


  • Added Q instrumentation.

    The node agent now accurately records programs using Q for promises.

    Thanks to @mdlavin for the contribution!

  • Added node-mysql2 support.

    Thanks to @jhollingworth for adding node-mysql2 support to the agent.

  • Query streaming in node-mysql now works while using the agent.

    Previously, due to the way node-mysql was instrumented query streaming would be forced off when the agent was collecting data. This is no longer the case and query streaming will work and be recorded as expected.