Ruby release notes

Thursday, February 20, 2020 - 12:00 Download

New Relic Ruby Agent Release Notes

  • Added support for W3C Trace Context, with easy upgrade from New Relic trace context

    • Distributed tracing now supports W3C Trace Context headers for HTTP protocols when distributed tracing is enabled. Our implementation can accept and emit both the W3C trace header format and the New Relic trace header format. This simplifies agent upgrades, allowing trace context to be propagated between services with older and newer releases of New Relic agents. W3C trace header format will always be accepted and emitted. New Relic trace header format will be accepted, and you can optionally disable emission of the New Relic trace header format.

    • When distributed tracing is enabled by setting distributed_tracing.enabled to true, the Ruby agent will now accept W3C's traceparent and tracestate headers when calling DistributedTracing.accept_distributed_trace_headers or automatically via http instrumentation. When calling DistributedTracing.insert_distributed_trace_headers, or automatically via http instrumentation, the Ruby agent will include the W3C headers along with the New Relic distributed tracing header, unless the New Relic trace header format is disabled by setting exclude_newrelic_header setting to true.

    • Added DistributedTracing.accept_distributed_trace_headers API for accepting both New Relic and W3C TraceContext distributed traces.

    • Deprecated DistributedTracing.accept_distributed_trace_payload which will be removed in a future major release.

    • Added DistributedTracing.insert_distributed_trace_headers API for adding outbound distributed trace headers. Both W3C TraceContext and New Relic formats will be included unless distributed_tracing.exclude_newrelic_header: true.

    • Deprecated DistributedTracing.create_distributed_trace_payload which will be removed in a future major release.

    Known issues and workarounds:

    • If a .NET agent is initiating distributed traces as the root service, you must update that .NET agent to version 8.24 or later before upgrading your downstream Ruby New Relic agents to this agent release.
  • Official Ruby 2.7 support

    The Ruby agent has been verified to run with Ruby 2.7.0.

  • Reduced allocations when tracing transactions using API calls

    Default empty hashes for options parameter were not frozen, leading to excessive and unnecessary allocations when calling APIs for tracing transactions.

    Thanks to Joel Turkel (jturkel) for the contribution!

  • Bugfix for Resque worker thread race conditions

    Recent changes in Rack surfaced issues marshalling data for Resque, surfaced a potential race-condition with closing out the worker-threads before flushing the data pipe. This is now fixed.

    Thanks to Bertrand Paquet (bpaquet) for the contribution!

  • Bugfix for Content-Length when injecting browser monitoring JS

    The Content-Length HTTP header would be incorrect after injecting the browser monitoring JS into the HEAD tag of the HTML source with Content-Length and lead to the HTML BODY content being truncated in some cases. The Content-Length is now correctly updated after injecting the browser monitoring JS script.

    Thanks to Slava Kardakov (ojab) for the contribution!

Monday, December 30, 2019 - 12:00 Download


  • Initial Ruby 2.7 support

    The Ruby agent has been verified to run with Ruby 2.7.0-preview1.

  • New API method to add custom attributes to Spans

    New API method for adding custom attributes to spans. Previously, custom attributes were only available at the Transaction level. Now, with Span level custom attributes, more granular tagging is possible for easier isolation and review of traces. For more information:

  • Enables ability to migrate to configurable security policies (CSP) on a per-agent basis for accounts already using high security mode (HSM).

    When both HSM and CSP are enabled for an account, an agent (this version or later) can successfully connect with either high_security: true or the appropriate security_policies_token configured. high_security has been added as part of the preconnect payload.

  • Bugfix for logs-in-context combined with act-fluent-logger-rails

    Previously, when using the Ruby agent's logs-in-context logger to link logging data with trace and entity metadata for an improved experience in the UI, customers who were also using the act-fluent-logger-rails gem would see a NoMethodError for clear_tags! that would interfere with the use of this feature. This error no longer appears, allowing customers to combine the use of logs-in-context with the use of this gem.

    Please note that the logs-in-context logger does not support tagged logging; if you are initializing your logger with a log_tags argument, your custom tags may not appear on the final version of your logs.

  • Bugfix for parsing invalid newrelic.yml

    Previously, if the newrelic.yml configuration file was invalid, and the agent could not start as a result, the agent would not log any indication of the problem.

    This version of the agent will emit a FATAL message to STDOUT when this scenario occurs so that customers can address issues with newrelic.yml that prevent startup.

  • Configuration options containing the terms "whitelist" and "blacklist" deprecated

    The following local configuration settings have been deprecated:

    • autostart.blacklisted_constants: use autostart.denylisted_constants instead.
    • autostart.blacklisted_executables: use autostart.denylisted_executables instead.
    • autostart.blacklisted_rake_tasks: use autostart.denylisted_rake_tasks instead.
    • strip_exception_messages.whitelist: use strip_exception_messages.allowed_classes instead.
  • Bugfix for module loading and constant resolution in Rails

    Starting in version 6.3, the Ruby agent has caused module loading and constant resolution to sometimes fail, which caused errors in some Rails applications. These errors were generally NoMethodError exceptions or I18n errors translation missing or invalid locale. These errors would not appear if the agent was removed from the application's Gemfile. This version of the agent fixes these issues with module loading and constant resolution, so these errors no longer occur.

  • Bugfix: failed to get urandom

    Previous versions of the agent would fail unexpectedly when the Ruby process used every available file descriptor. The failures would include this message:

    ERROR : RuntimeError: failed to get urandom

    This version of the agent uses a different strategy for generating random IDs, and will not fail in the same way when no file descriptors are available.

Tuesday, October 1, 2019 - 16:07


  • Support for Real Time Streaming

    • Event data is now sent to New Relic every five seconds, instead of every minute. As a result, transaction, error, and custom events will now be available in New Relic One and Insights dashboards in near real time. For more information on how to view your events with a five-second refresh, see the real time streaming documentation.

    • Note that the overall limits on how many events can be sent per minute have not changed. Also, span events, metrics, and trace data is unaffected, and will still be sent every minute.

  • Trace and Entity Metadata API

    Several new API methods have been added to the agent:

    These API methods allow you to access information that can be used to link data of your choosing to a trace or entity.

  • Logs in Context

    This version of the agent includes a logger, which can be used in place of ::Logger from the standard library, or ActiveSupport::Logger from Rails. This logger leverages the new trace and entity metadata API to decorate log statements with entity and trace metadata, so they can be correlated together in the New Relic UI.

    For more information on how to use logs in context, see

  • Project metadata in Gemspec

    Project metadata has been added to the gemspec file. This means our Rubygems page will allow users to more easily access the agent's source code, raise issues, and read the changelog.

    Thanks to Orien Madgwick for the contribution!

Thursday, September 5, 2019 - 11:05 Download


  • Bugfix for ActionCable Instrumentation

    Previous versions of the agent sometimes caused application crashes with some versions of ActionCable. The application would exit quickly after startup with the error: uninitialized constant ActionCable::Engine.

    Version 6.6.0 of the agent no longer crashes in this way.

  • Handling of disabling Error Collection

    When the agent first starts, it begins collecting Error Events and Traces before fetching configuration from New Relic. In previous versions of the agent, those events or traces would be sent to New Relic, even if Error Collection is disabled in the application's server-side configuration.

    Version 6.6.0 of the agent drops all collected Error Events and Traces if the configuration from the server disables Error Collection.

Wednesday, June 26, 2019 - 03:00 Download


Change to default setting for ActiveRecord connection resolution

Due to incompatibilities between the faster ActiveRecord connection resolution released in Ruby agent v6.3.0 and other gems that patch ActiveRecord, backport_fast_active_record_connection_lookup will now be set to false by default. This will result in significant performance improvement.

Recommendation: If your environment includes ActiveRecord, change this setting to true.

Exception: If you are using other gems that measure ActiveRecord performance, they may lose functionality when combined with this setting. If you are unsure whether to enable backport_fast_active_record_connection_lookup, we recommend enabling it in a development environment to make sure other gems that patch ActiveRecord are still working as expected.


  • Bugfix for ActiveStorage instrumentation error

    Version 6.4.0 of the agent introduced a bug that interfered with ActiveStorage callbacks, resulting in the agent being unable to instrument ActiveStorage operations. ActiveStorage segments are now correctly recorded.

  • Bugfix for ActiveRecord 4.1 and 4.2 exception logging

    Version 6.3.0 of the agent introduced a bug that prevented ActiveRecord versions 4.1 and 4.2 from logging exceptions that occurred within a database transaction. This version of the agent restores the exception logging functionality from previous agent versions. Thanks to Oleksiy Kovyrin for the contribution!


The Ruby agent now enforces a maximum of 10,000 transaction events and custom events and 100 error events per minute.

Tuesday, May 28, 2019 - 03:34 Download


  • Custom Metadata Collection

    The agent now collects environment variables prefixed by NEW_RELIC_METADATA_. These may be added to transaction events to provide context between your Kubernetes cluster and your services. For details on the behavior, see this blog post.

  • Bugfix for faster ActiveRecord connection resolution

    Version 6.3.0 of the agent backported the faster ActiveRecord connection resolution from Rails 6.0 to previous versions, but the implementation caused certain other gems which measured ActiveRecord performance to stop working. This version of the agent changes the implementation of this performance improvement so no such conflicts occur.

  • Bugfix for Grape instrumentation error

    Previous versions of the agent would fail to install Grape instrumentation in Grape versions 1.2.0 and up if the API being instrumented subclassed Grape::API::Instance rather than Grape::API. A warning would also print to the newrelic_agent log:

    WARN : Error in Grape instrumentation
    WARN : NoMethodError: undefined method `name' for nil:NilClass

    This version of the agent successfully installs instrumentation for subclasses of Grape::API::Instance, and these log messages should no longer appear.

  • Bugfix for streaming responses

    Previous versions of the agent would attempt to insert JavaScript instrumentation into any streaming response that did not make use of ActionController::Live. This resulted in an empty, non-streamed response being sent to the client.

    This version of the agent will not attempt to insert JavaScript instrumentation into a response which includes the header Transfer-Encoding=chunked, which indicates a streaming response.

    This should exclude JavaScript instrumentation for all streamed responses. To include this instrumentation manually, see Manually instrument via agent API in our documentation.

Tuesday, April 30, 2019 - 12:00 Download


  • Official Rails 6.0 support

    This version of the agent has been verified against the Rails 6.0.0 release.

    As ActiveRecord 4, 5, and 6 use the same New Relic instrumentation, the disable_active_record_4 and disable_active_record_5 settings in NewRelic.yml are being deprecated in favor of the new disable_active_record_notifications. This new setting will affect the instrumentation of ActiveRecord 4, 5, and 6. The deprecated settings will be removed in a future release.

  • Bugfix for newrelic deployments script

    For applications housed in the EU, the newrelic deployments script included with previous versions of the agent would fail with the following message: Deployment not recorded: Application does not exist. This is because the script would attempt to send the deployment notification to the US region. The deployment script now sends deployments to the correct region.

  • Faster ActiveRecord connection resolution

    This version of the agent uses the faster ActiveRecord connection resolution that Rails 6.0 uses, even on previous versions of Rails. Thanks to Callum Jones for the contribution!

  • Support non-ascii characters in hostnames

    Previous versions of the agent would frequently log warnings like: log writing failed. "\xE2" from ASCII-8BIT to UTF-8 if the hostname contained a non-ascii character. This version of the agent will no longer log these warnings. Thanks to Rafael Petry for the contribution!

Monday, March 18, 2019 - 12:00 Download


  • Bugfix for superfluous Empty JSON response error messages

    Version 6.1.0 of the agent frequently logged error messages about an empty JSON response, when no error had occurred. These logs no longer appear.

  • Bugfix for Unable to calculate elapsed transaction time warning messages

    Ruby Agent versions 5.4 through 6.1, when running in jruby without ObjectSpace enabled, would occasionally log a warning indicating that the agent was unable to calculate the elapsed transaction time. When this log statement appeared, the affected transactions would not be included in the data displayed on the capacity analysis page. These transactions are now correctly recorded.

Tuesday, February 26, 2019 - 09:00 Download


  • Performance monitoring on Kubernetes

    This release adds Transaction event attributes that provide context between your Kubernetes cluster and services. For details on the benefits, see this blog post.

  • Bugfix for Bunny instrumentation when popping empty queues

    When a customer calls Bunny::Queue#pop on an empty queue, Bunny returns a nil value. Previous Ruby Agent versions raised a NoMethodError when trying to process this result. Now, the agent correctly skips processing for nil values. Thanks to Matt Campbell for the contribution.

Monday, January 28, 2019 - 11:55 Download


  • Tracer API for flexible custom instrumentation

    With agent version 6.0, we are introducing the Tracer class, an officially supported public API for more flexible custom instrumentation. By calling its in_transaction method, you can instrument an arbitrary section of Ruby code without needing to juggle any explicit state. Behind the scenes, the agent will make sure that the measured code results in an APM segment inside a transaction.

    The same API contains additional methods for creating transactions and segments, and for interacting with the current transaction. For more details, see the custom instrumentation documentation.

    If you were previously using any of the agent's private, undocumented APIs, such as Transaction.wrap or Transaction.start/stop, you will need to update your code to use the Tracer API.

    The full list of APIs that were removed or deprecated are:

    • External.start_segment
    • Transaction.create_segment
    • Transaction.start
    • Transaction.stop
    • Transaction.start_datastore_segment
    • Transaction.start_segment
    • Transaction.wrap
    • TransactionState.current_transaction

      If are you using any of these APIs, please see the upgrade guide for a list of replacements.

  • Agent detects Rails 6.0

    The agent properly detects Rails 6.0 and no longer logs an error when started in a Rails 6.0 environment. This does not include full Rails 6.0 support, which will be coming in a future release. Thanks to Jacob Bednarz for the contribution.

Monday, January 14, 2019 - 13:39 Download


  • Ruby 2.6 support

    We have tested the agent with the official release of Ruby 2.6.0 made on December 25, 2018.

  • Support for loading Sequel core standalone

    The agent will now enable Sequel instrumentation when an application loads Sequel's core standalone, which does not use the Sequel:Model class. Thanks to Vasily Kolesnikov for the contribution!

  • Grape 1.2 support

    With agent versions 5.6 and earlier, Grape 1.2 apps reported their transactions under the name Proc#call instead of the name of the API endpoint. Starting with agent version 5.7, all existing versions of Grape will report the correct transaction name. Thanks to Masato Ohba for the contribution!

Wednesday, December 12, 2018 - 12:44 Download


  • Bugfix for transactions with ActionController::Live

    Previously, transactions containing ActionController::Live resulted in incorrect calculations of capacity analysis as well as error backtraces appearing in agent logs in agent versions 5.4 and later. The agent now correctly calculates capacity for transactions with ActionController::Live.

  • Add ability to exclude attributes from span events and transaction segments

    Agent versions 5.5 and lower could selectively exclude attributes from page views, error traces, transaction traces, and transaction events. With agent version 5.6 and higher, you can also exclude attributes from span events (via the span_events.include/exclude options) and from transaction segments (via the transaction_segments.include/exclude options).

    As with other attribute destinations, these new options will inherit values from the top-level attributes.include/exclude settings. See the documentation for more information.

  • Increasing backoff sequence on failing to connect to New Relic

    If the agent cannot reach New Relic, it will now wait for an increasing amount of time after each failed attempt. We are also starting with a shorter delay initially, which will help customer apps bounce back more quickly from transient network errors.

  • Truncation of long stack traces

    Previous versions of the agent would truncate long stack traces to 50 frames. To give customers more flexibility, we have added the error_collector.max_backtrace_frames configuration option. Thanks to Patrick Tulskie for the contribution!

  • Update link in documentation

    The community forum link in now goes to the updated location. Thanks to Sam Killgallon for the contribution!

  • Active Storage instrumentation

    The agent now provides instrumentation for Active Storage, introduced in Rails 5.2. Customers will see Active Storage operations represented as segments within transaction traces.

Thursday, November 8, 2018 - 11:25 Download


  • Bugfix for perform instrumentation with curb gem

    Use of curb's perform method now no longer results in nil headers getting returned.

  • Bugfix for parsing Docker container IDs

    The agent now parses Docker container IDs correctly regardless of the cgroup parent.

  • Use lazy load hooks for ActiveJob instrumentation

    In some instances the ActiveJob instrumentation could trigger ActiveJob to load before it was initialized by Rails. This could result in configuration changes not being properly applied. The agent now uses lazy load hooks which fixes this issue.

  • Documentation improvement

    The diagram of the agent's configuration settings no longer includes the deleted developer_mode option. Thanks to Yuichiro Kaneko for the contribution!

Tuesday, September 11, 2018 - 10:45 Download


  • Capacity analysis for multi-threaded dispatchers

    Metrics around capacity analysis did not previously account for multi-threaded dispatchers, and consequently could result in capacities of over 100% being recorded. This version now properly accounts for multi-threaded dispatchers.

  • NewRelic::Agent.disable_transaction_tracing deprecated

    NewRelic::Agent.disable_transaction_tracing has been deprecated. Users are encouraged to use NewRelic::Agent.disable_all_tracing or NewRelic::Agent.ignore_transaction instead.

  • Bugfix for SQL over-obfuscation

    A bug, introduced in v5.3.0, where SQL could be over-obfuscated for some database adapters has been fixed.

  • Bugfix for span event data in Resque processes

    A bug where span events would not be sent from Resque processes due to a missing endpoint has been fixed.

Tuesday, July 31, 2018 - 10:52 Download


  • 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 thedistributed_tracing.enabled configuration option to true.

Monday, June 4, 2018 - 11:52 Download


  • Use priority sampling for errors and custom events

    Priority sampling replaces the older reservoir event sampling method. With this change, the agent will maintain randomness across a given time period while improving coordination among transactions, errors, and custom events.

  • Bugfix for wrapping datastore operations

    The agent will now complete the process of wrapping datastore operations even if an error occurs during execution of a callback.

Monday, April 30, 2018 - 10:31 Download


  • Rails 5.2 support

    The Ruby agent has been validated against the latest release of Ruby on Rails!

  • Support for newer libraries and frameworks

    We have updated the multiverse suite to test the agent against current versions of several frameworks.

  • Add custom_attributes.enabled configuration option

    This option is enabled by default. When it's disabled, custom attributes will not be transmitted on transaction events or error events.

  • Fix Grape load order dependency

    The agent will now choose the correct name for Grape transactions even if the customer's app loads the agent before Grape. Thanks to Daniel Doubrovkine for the contribution!

  • Add webpacker:compile to blacklisted tasks

    webpacker:compile is commonly used for compiling assets. It has been added to AUTOSTART_BLACKLISTED_RAKE_TASKS in the default configuration. Thanks to Claudio B. for the contribution!

  • Make browser instrumentation W3C-compliant

    type="text/javascript" is optional for the <script> tag under W3C. The type attribute has now been removed from browser instrumentation. Thanks to Spharian for the contribution!

  • Deferred add_method_tracer calls

    If a third-party library calls add_method_tracer before the agent has finished starting, we now queue these calls and run them when it's safe to do so (rather than skipping them and logging a warning).

  • Bugfix for Resque around / before hooks

    In rare cases, the agent was not instrumenting Resque around and before hooks. This version fixes the error.

  • Truncation of long stack traces

    Occasionally, long stack traces would cause complications sending data to New Relic. This version truncates long traces to 50 frames (split evenly between the top and bottom of the trace).

Monday, March 26, 2018 - 11:05 Download


  • SSL connections to New Relic are now mandatory

    Prior to this version, using an SSL connection to New Relic was the default behavior, but could be overridden. SSL connections are now enforced (not overrideable).

  • Additional security checking before trying to explain multi-statement SQL queries

    Customer applications might submit SQL queries containing multiple statements (e.g., SELECT * FROM table; SELECT * FROM table). For security reasons, we should not generate explain plans in this situation.

    Although the agent correctly skipped explain plans for these queries during testing, we have added extra checks for this scenario.

  • Bugfix for RabbitMQ exchange names that are symbols

    The agent no longer raises a TypeError when a RabbitMQ exchange name is a Ruby symbol instead of a string.

  • Bugfix for audit logging to stdout

    Previous agents configured to log to stdout would correctly send regular agent logs to stdout, but would incorrectly send audit logs to a text file named "stdout". This release corrects the error.

  • Bugfix for Capistrano deployment notifications on v3.7 and beyond

    Starting with version 3.7, Capistrano uses a different technique to determine a project's version control system. The agent now works correctly with this new behavior. Thanks to Jimmy Zhang for the contribution.

Wednesday, January 31, 2018 - 11:05 Download


  • Initialize New Relic Agent before config initializers

    When running in a Rails environment, the agent registers an initializer that starts the agent. This initializer is now defined to run before config/initializers. Previously, the ordering was not specified for the initializer. This change guarantees the agent will started by the time your initializers run, so you can safely reference the Agent in your custom initializers. Thanks to Tony Ta for the contribution.

  • Ruby 2.5 Support

    The Ruby Agent has been verified to run under Ruby 2.5.

  • request.uri Collected as an Agent Attribute

    Users can now control the collection of request.uri on errors and transaction traces. Previously it was always collected without the ability to turn it off. It is now an agent attribute that can be controlled via the attributes config. For more information on agent attributes see here.

Friday, December 22, 2017 - 12:52


  • Bugfix for Manual Browser Instrumentation

    There was a previous bug that required setting both rum.enabled: false and browser.auto_instrument: false to completely disable browser monitoring. An attempt to fix this in 4.7.0 resulted in breaking manual browser instrumentation. Those changes have been reverted. We will revisit this issue in an upcoming release.