Node.js Release Notes

Node.js Agent Release Notes

Monday, December 3, 2018 - 10:59 Download

New features

  • Added IP address collection and forwarding of metadata headers for upcoming protocol 17.

    These features are currently behind the protocol_17 feature flag until all parts of protocol 17 are implemented.

Improvements

  • Converted error handling in CollectorAPI and RemoteMethod to callbacks.

    Previously many of the errors were thrown. For consistency with async errors, these are now handed to the callback instead of thrown. The old behavior could result in a crash under a few circumstances, such as when the agent exceeded a configured maximum payload size. These errors came from RemoteMethod._safeRequest. Since these errors are handed to the callback instead of thrown, this bug is no longer a potential.

  • Refactored harvest interactions in preparation for protocol 17 status codes.

Thursday, November 15, 2018 - 12:10 Download

New features

  • Added protocol_17 feature flag.

    Flag will be removed and protocol will be hard-coded to 17 once functionality is released on New Relic backend.

  • This release also includes changes to the agent to enable monitoring of Lambda functions. If you are interested in learning more or previewing New Relic Lambda monitoring please email lambda_preview@newrelic.com.

  • Added waitForIdle option to API#shutdown.

    This new option will make the agent wait for all active transactions to finish before actually shutting down. This does not pre-empt creation of new transactions, so care must be taken to ensure the active transaction pool drains or the agent will never shut down.

Improvements

  • Added switch statement indenting standard to eslintrc

  • Introduced "warn" level 2 space rule to eslintrc

  • Upgraded @newrelic/test-utilities to v2.

Bug fixes

  • Changed totalTime attribute to be in decimal seconds instead of milliseconds for transaction events.

  • Agent no longer produces spans on ignored transactions.

    Previously, the agent would produce distributed tracing span events regardless of the ignored status of the transaction the events originated from.

  • Extended Restify instrumentation to mark possible transaction names in order to account for async response methods.

  • Updated hapi@16 versioned tests to only run on Node 6 and above.

  • Pinned mysql2 to <1.6.2 in versioned tests.

Thursday, November 1, 2018 - 14:06 Download

New features

  • Added DatastoreShim#getDatabaseNameFromUseQuery

    This new method can be used to extract the database name from USE SQL queries.

Improvements

  • Added link to CONTRIBUTING.md file in README.md

    Thanks to Yuri Tkachenko (@tamtamchik) for the contribution.

  • Added VS Code settings to git ignore.

  • Fixed bug preventing Distributed Tracing (DT) from fully functioning when Cross Application Tracing (CAT) was disabled.

  • Renames better-cat integration test organization to be distributed-tracing and updated some test verbiage to use DT or distributed tracing instead of CAT or cross application tracing.

Bug fixes

  • The agent will no longer break express routers in the case of using regex paths in a list.

    Previously, the agent would overwrite the regex with the source of the regex. The agent now makes a copy of the route array and mutates that instead.

  • Attributes will now be properly propagated to PageView events.

    The agent may now be configured to pass attributes along to the browser agent. The attributes that match the include/exclude rules in the browser_monitor.attributes section will now be placed on PageView events.

Monday, October 1, 2018 - 11:16 Download

New features

  • Added superagent as built-in instrumentation.

    This instrumentation just maintains transaction state when using the superagent module to make HTTP requests with either callbacks or promises.

  • Updated noticeError API method to be partially functional in High Security Mode.

    In HSM, any custom attributes will be ignored, but the error will still be tracked. This brings the Node agent in line with the behavior of other language agents.

  • Added PromiseShim class for instrumenting promise libraries.

  • Support for setting transaction_tracer.transaction_threshold to 0 has been added.

Improvements

  • Updated DT payload creation to use primary_application_id from connect response.

  • Added protection against functions with modified prototypes in shim.applySegment.

  • Replaced SQL ID hash generation algorithm with SHA1 instead of MD5 to allow usage in FIPS compliant environments.

  • Leveraged 16 hex digits for creation of SQL ID.

  • Upgraded ejs module to get rid of Github security warnings. The ejs module was only used for tests and not in main agent code.

  • Changes DT payload configuration log messages to debug level as it is not uncommon for calls to occur before server configuration has been retrieved.

  • Converted net instrumentation to use shim api.

  • Converted child_process instrumentation to newer shim style.

  • Converted Timers instrumentation to newer shim style.

  • Converted zlib instrumentation to use shim API.

Bug fixes

  • Fixed codec.decode() callback bug that would re-call a callback with an error thrown within the callback.

  • Fixed bug requiring Cross Application Tracing (CAT) to be enabled for Distributed Tracing (DT) createDistributedTracePayload and acceptDistributedTracePayload APIs to function. DT configuration will no longer consider CAT configuration.

  • Fixed bug in wrap() that would fail to wrap callbacks if the callback index was 0.

  • The agent now respects NEW_RELIC_TRACER_THRESHOLD.

    Previously, this environment variable was stored as a string. The environment variable is now stored as a float.

Monday, August 27, 2018 - 13:35 Download

Improvements

  • Converted File System instrumentation to use newer shim style.

  • Converted DNS instrumentation to newer shim style.

  • Added tracking of callbacks to DNS instrumentation.

  • Converted crypto instrumentation to newer shim style.

  • Updated domains instrumentation to use an instrumentation shim.

  • Refactored the global instrumentation to use the shim API.

  • Ported inspector instrumentation to use an instrumentation shim.

  • Ported async_hooks based promise instrumentation over to using shims.

  • Added shim types for core instrumentations.

  • Improved benchmark comparison output.

  • Added http benchmark tests.

Bug fixes

  • Agent instrumentation will no longer interfere with promisification of core methods.

    Some core methods expose pre-promisified versions of the methods as a reference on the method itself. When instrumenting these methods, it neglected to forward these references onto the wrapper function. Now the instrumentation will properly forward property look ups to the original method.

  • Fixed outbound https call to use example.com to resolve integration test issue.

  • Fixed tests for ioredis 4.0.0 and above.

Monday, August 13, 2018 - 12:42 Download

Improvements

  • Implemented enforcement of max_payload_size_in_bytes config value.

    Any payload during the harvest sequence that exceeds the configured limit will be discarded.

  • Added JSON-formatted output to benchmarks to enable automated benchmark comparison.

  • Updated the benchmark runner to measure specifically userland CPU overhead.

  • Added DatastoreShim benchmarks.

Bug fixes

  • Fixed MongoDB instrumentation for driver versions greater than 3.0.6.

    Mongo 3.0.6 removed metadata the Agent relied upon to instrument the driver. This fixes that by going back to the old method of manually listing all objects and methods to instrument.

  • Updated MySQL versioned tests to run against the latest release.

Tuesday, July 31, 2018 - 11:05

New features

  • Added support for distributed tracing.

    Distributed tracing lets you see the path that a request takes as it travels through your distributed system. By showing the distributed activity through a unified view, you can troubleshoot and understand a complex system better than ever before.

    Distributed tracing is available with an APM Pro or equivalent subscription. To see a complete distributed trace, you need to enable the feature on a set of neighboring services. Enabling distributed tracing changes the behavior of some New Relic features, so carefully consult the transition guide before you enable this feature.

    To enable distributed tracing, set distributed_tracing.enabled to true in your newrelic.js file, or set NEW_RELIC_DISTRIBUTED_TRACING_ENABLED in your environment.

  • Added a warning for too-new versions of Node.js during agent startup.

  • Appropriately obfuscated SQL statements will now be included in all transaction traces.

    Previously, the agent would only include the SQL statements if the corresponding query was sufficiently slow.

  • Added ability to execute instrumentation functions in the context of the segment the segment descriptor is describing.

    All record* methods supplied by all instrumentation shim classes now allow for a function to be executed under the context of the segment the record call will produce. This may be done by supplying a function in the inContext key for the segment descriptor passed to the record method.

  • Reservoirs will now respect setting their size to 0.

Tuesday, July 24, 2018 - 10:45

New features

  • Added full support for Node v10.

  • Added instrumentation for crypto.scrypt.

  • Added instrumentation for fs.realpath.native.

  • Added instrumentation for process.setUncaughtExceptionCaptureCallback.

Fixes

  • Updated tests to use asyncResource.runInAsyncScope instead of emitBefore and emitAfter
Wednesday, July 18, 2018 - 17:01

Fixes

  • The agent will now properly remerge event data on collection failure.

Previously, the agent wouldn't observe the correct format for remerging, causing undefined events to be pushed into the reservoir.

Monday, July 16, 2018 - 10:10 Download

New features

  • Feature flags may now be set from environment variables.

    Using the naming convention NEW_RELIC_FEATURE_FLAG_<feature flag name in upper case>.

Improvements

  • Transaction events may be harvested in two payloads now.

    This change reduces the occurrence of harvests being rejected due to large payloads. Payloads will only be split when they are large (greater than 1/3 the maximum).

Bug fixes

  • Updated Hapi v17 instrumentation to wrap server export, in addition to Server.
Thursday, July 12, 2018 - 10:36 Download

Improvements

  • Replaced trusted_account_ids array with trusted_account_key.

  • Added node v10 to the test matrix.

Bug fixes

  • Added config utilization env vars to the BOOLEAN_VARS set.

    This ensures that if these boolean config values are set outside of a config file, their values are respected, particularly when they are disabled.

Monday, July 9, 2018 - 11:30

Improvements

  • Added nonce option for newrelic.getBrowserTimingHeader()

    This allows people to pass in a string to be injected as the nonce property of the generated script tag. Special thanks to João Vieira (@joaovieira) for contributing this feature!

  • Expose the External segment on the http request instance for outbound calls.

Fixes

  • Added check to mark Hapi 'onPreResponse' extensions as error handlers.

    Previously, the agent was unable to mark any Hapi errors as handled, even if they were, resulting in inaccurate reporting. This change assumes that 'onPreResponse' extensions act as error handlers, so errors are only reported if they persist to the final response.

Monday, July 2, 2018 - 12:08

Improvements

  • Added more tests for transaction naming with Restify.

Fixes

  • Fixed issue with tracking external requests to default ports.

    Special thanks to Ryan King for pinpointing the cause of this issue.

  • Added extra check for handling arrays of functions when wrapping middleware mounters.

    This fixes a bug with the agent incorrectly assuming that arrays passed as the first argument in middleware would only contain route paths, causing a fatal error.

  • The agent now reports the total time of the transaction on transaction events.

Tuesday, June 19, 2018 - 14:44 Download

New features

  • Added an option for using the finally method on promises for instrumentation.

    The promise instrumentation would use Promise#finally if available. This change is in response to Node v10 promises calling then inside their finally method, which caused infinite recursion in the agent's promise instrumentation.

  • Added seen/sent/dropped supportability metrics for all event collections.

Improvements

  • Refactored harvest cycle into separate class.

    This refactoring eases managing harvested data and re-merging unharvested values on failure.

  • No longer download gcc on test suites that do not require it.

Bug fixes

  • Updated WebFrameworkShim to handle arrays of routes when wrapping middleware mounters.

    Previously, a transaction that hit a shared middleware (eg, app.use(['/one', '/two'], ...)) would always be tagged with <unknown> in its name, due to the agent not interpreting arrays of paths. Now transaction names will include all paths for a shared middleware, comma-delimited, followed by the current route ('WebTransaction/Expressjs/GET//one,/two/one').

Monday, June 11, 2018 - 12:39

Fixes

  • Make require() statements explicitly reference package.json as a .json file.

This solves a problem when requiring/importing newrelic from a Typescript file.

  • Check if process.mainModule.filename exists before using in missing config file check.

When the agent is preloaded with Node's --require flag, mainModule is not yet defined when the agent checks for a config file, resulting in a TypeError in the event that no config file exists. Defaulting to the file path being executed in process.argv ensures that the app will not crash when preloaded without a config file.

  • Updated dev dependency tap to v12.0.1.

  • Fixed identification of errors with express.

Previously the call next('router') was considered an error. This is actually valid usage of express and will no longer generate an error.

  • Removed debug.internal_metrics configuration.

This legacy debug configuration was never used since trace-level logging provides everything this did and more.

  • Upgraded optional dependency @newrelic/native-metrics to v3.

With this update comes pre-built binaries for Node 5 and 7. GC metrics are also now aggregated in C++ until the agent is ready to harvest them instead of hopping into JS for each event.

  • Added additional checks to uninstrumented ensuring that files with names matching instrumented modules do not result in a false uninstrumented status.

For example, some users load config/env info before the agent. In that case, a file responsible for exporting DB config information (config/redis.js), may result in a false uninstrumented status, because the agent would interpret redis.js as the module itself.

Tuesday, May 29, 2018 - 15:21

Fixes

  • Fixed metric merging when using debug.internal_metrics.

    The debug metrics cache would cause timestamps for harvested metrics to get stuck at agent startup. This will no longer happen, and the debug cache is reset each harvest.

Improvements

  • Modularized configuration constants to improve readability.
Tuesday, May 22, 2018 - 14:13

Fixes

  • Updated use of fs.unlink without a callback to fs.unlinkSync.

    As of Node v10, the callback is no longer optional, which was causing a false test failure.

  • Fixed access to properties on promisified methods.

Tuesday, May 15, 2018 - 13:40 Download

Improvements

  • Optimized unhandledRejection reporting when using async_hooks.

  • Replaced all uses of util._extend with Object.assign.

  • Completed TODOs regarding the Node 0.10 and 0.12 deprecation.

  • Added PriorityQueue serialization benchmarks.

Bug fixes

  • The agent no longer resizes the metric timeslice start time to be the earliest start time of the transactions that finish during the timeslice.

  • Background transactions created may now be named through API#setTransactionName.

    Previously, the agent didn't respect the transaction naming precedence for background transactions. Background transaction naming behavior is now in line with web transaction behavior.

  • Logger no longer tries to create very large log messages.

    When a message is created that would be too large to log, a process warning is emitted.

  • The agent will now respect event count limits when merging data from a failed send.

    Previously, when merging data into an event pool the agent wouldn't maintain the size limit of the reservoir.

  • Added check for a route prefix when wrapping Hapi route handlers.

    Previously, route prefixes specified via plugin options weren't being included in transaction names. Now, if the agent finds a route prefix associated with a given realm, it is prepended to the route path in the transaction name.

Monday, April 23, 2018 - 15:06

Improvements

  • Added PriorityQueue class for collecting events.

    This replaces the Reservoir class for event sampling. Using priority sampling allows the agent to maintain randomness across a given time period while improving the chances that events will be coordinated across Transaction, Error, and Custom event pools.

  • The agent will now allow external instrumentation modules to fail in a safe way.

    Previously, the agent would stop running if an externally loaded instrumentation failed for any reason. Due to the way external instrumentations can be updated independently, the agent should allow them to fail and carry on after logging a warning.

  • Added the strip_exception_messages.enabled config option.

    The agent can now be configured to redact error messages on collected errors.

  • Added the attributes.include_enabled config option.

    The agent can now be configured to disallow attribute include patterns to be specified.

Fixes.

  • Updated logic around wrapping route handlers when config object is present.

    Before, the agent would only attempt to wrap config.handler when any config object was present, without defaulting to the root handler if it didn't exist.

Thursday, April 12, 2018 - 00:00

Fixes

  • BREAKING: Updated the version of https-proxy-agent to v2.x - Dropped support for v0.10 and v0.12 of node.

    The version of https-proxy-agent used in the agent has a known security issue you can read about here: https://snyk.io/vuln/npm:https-proxy-agent:20180402 In order to resolve this issue, the dependency had to be updated to at least v2.2.0, which only supported node versions >=4. The update to this dependency forces the incompatibility of the agent with versions 0.10 and 0.12 of node.

    In order to use use the Node.js agent, please upgrade node to version >=4, or you can continue to use the agent on node versions 0.10 and 0.12 by pinning the agent to v3.

    You can read more about the issue here: https://docs.newrelic.com/docs/using-new-relic/new-relic-security/securi...

Pages