Ruby Release Notes

Ruby Agent Release Notes

Thursday, May 25, 2017 - 13:56


  • Sinatra 2.0 and Padrino 0.14.x Support

    The agent has been verified against the latest versions of Sinatra and Padrino.

  • Rails 5.1 Support

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

  • APP_ENV considered when determining environment

    The agent will now consider the APP_ENV environment when starting up.

  • Test files excluded from gem

    The gemspec has been updated to exclude test files from being packaged into the gem. Thanks dimko for the contribution!

Wednesday, April 12, 2017 - 13:45


  • Developer Mode removed

    The Ruby Agent's Developer Mode, which provided a very limited view of your application performance data, has been removed. For more information, check out our community forum.

  • Support NEW_RELIC_ENV for Rails apps

    Previously, users could set the agent environment with NEW_RELIC_ENV only for non-Rails apps. For Rails app, the agent environment would use whatever the Rails environment was set to. Now, NEW_RELIC_ENV can also be used for Rails apps, so that it is possible to have an agent environment that is different from the Rails environment. Thanks Andrea Campolonghi for the contribution, as well as Steve Schwartz for also looking into this issue!

  • Normalization of external hostnames

    Hostnames from URIs used in external HTTP requests are now always downcased to prevent duplicate metrics when only case is different.

Thursday, March 16, 2017 - 11:00 Download


  • Require Ruby 2.0.0+

    The agent no longer supports Ruby versions prior to 2.0, JRuby 1.7 and earlier, and all versions of Rubinius. Customers using affected Rubies can continue to run 3.x agent versions, but new features or bugfixes will not be published for 3.x agents. For more information, check out our community forum.

  • OkJson vendored library removed

    Ruby 1.8 did not include the JSON gem by default, so the agent included a vendored version of OkJson that it would fall back on using in cases where the JSON gem was not available. This has been removed.

  • YAJL workaround removed

    yajl-ruby versions prior to 1.2 had the potential to cause a segmentation fault when working large, deeply-nested objects like thread profiles. If you are using yajl-ruby with the JSON monkey patches enabled by requiring yajl/json_gem, you should upgrade to at least version 1.2.

  • Deprecated APIs removed

    • Agent.abort_transaction!
    • Agent.add_custom_parameters
    • Agent.add_request_parameters
    • Agent.browser_timing_footer
    • Agent.get_stats
    • Agent.get_stats_no_scope
    • Agent.record_transaction
    • Agent.reset_stats
    • Agent.set_user_attributes
    • Agent::Instrumentation::Rack
    • ActionController#newrelic_notice_error
    • ActiveRecordHelper.rollup_metrics_for (may be incompatible with newrelic_moped)
    • Instrumentation::MetricFrame.recording_web_transaction?
    • Instrumentation::MetricFrame.abort_transaction!
    • MethodTracer.get_stats_scoped
    • MethodTracer.get_stats_unscoped
    • MethodTracer.trace_method_execution
    • MethodTracer.trace_method_execution_no_scope
    • MethodTracer.trace_method_execution_with_scope
    • MetricSpec#sub
    • MetricStats#get_stats
    • MetricStats#get_stats_no_scope
    • NoticedError#exception_class
    • Rack::ErrorCollector
    • StatsEngine::Samplers.add_sampler
    • StatsEngine::Samplers.add_harvest_sampler

    The above methods have had deprecation notices on them for some time and have now been removed. Assistance migrating usage of these APIs is available at .

    The agent no longer deletes deprecated keys passed to add_method_tracer. Passing in deprecated keys can cause an exception. Ensure that you are not passing any of the following keys: :force, :scoped_metric_only, :deduct_call_time_from_parent to add_method_tracer.

    The agent no longer deletes deprecated keys passed in as options to NewRelic::Agent.notice_error. If you are passing any of these deprecated keys: :request_params, :request, :referer to the notice_error API, please delete them otherwise they will be collected as custom attributes.

  • Error handling changes

    The agent now only checks for original_exception in environments with Rails versions prior to 5. Checking for Exception#cause has been removed. In addition, the agent now will match class name with message and backtrace when noticing errors that have an original_exception.

Thursday, February 9, 2017 - 11:21 Download


  • Ensure Mongo aggregate queries are properly obfuscated

    Instrumentation for the Mongo 2.x driver had a bug where the pipeline attribute of Mongo aggregate queries was not properly obfuscated. Users who have sensitive data in their aggregate queries are strongly encouraged to upgrade to this version of the agent. Users who are unable to upgrade are encouraged to turn off query collection using by setting mongo.capture_queries to false in their newrelic.yml files.

    This release fixes New Relic Security Bulletin NR17-03.

  • Early access Redis 4.0 instrumentation

    Our Redis instrumentation has been tested against Redis 4.0.0.rc1.

Monday, January 23, 2017 - 11:30 Download


  • Ruby 2.4.0 support

    The agent is now tested against the official release of ruby 2.4.0, excluding incompatible packages.

  • Agent-based metrics will not be recorded outside of active transactions

    The agent has historically recorded metrics outside of a transaction. In practice, this usually occurs in applications that run background job processors. The agent would record metrics for queries the background job processor is making between transactions. This can lead to display issues on the background overview page and the presence of metrics generated by the background job processor can mask the application generated metrics on the database page. The agent will no longer generate metrics outside of a transaction. Custom metrics recorded using NewRelic::Agent.record_metric will continue to be recorded regardless of whether there is an active transaction.

  • Include ControllerInstrumentation module with ActiveSupport.on_load

    The agent will now use the on_load :action_controller hook to include the ControllerInstrumentation module in to both the Base and API classes of ActionController for Rails 5. This ensures that the proper load order is retained, minimizing side-effects of having the agent in an application.

  • Ensure values for revisions on Capistrano deploy notices

    Previously, running the task to look up the changelog could generate an error, if there weren't previous and current revisions defined. This has now been fixed. Thanks Winfield Peterson for the contribution!

  • External Segment Rewrites

    The agent has made internal changes to how it represents segments for external web requests.

Tuesday, December 13, 2016 - 10:55 Download


  • Compatibility with Ruby 2.4.0-preview3

    The Ruby agent has been updated to work on Ruby 2.4.0-preview3.

  • Early Access Sinatra 2.0 instrumentation

    Our Sinatra instrumentation has been updated to work with Sinatra 2.0.0.beta2.

  • Include controller instrumentation module in Rails 5 API

    The agent now includes the ControllerInstrumentation module into ActionController::API. This gives Rails API controllers access to helper methods like newrelic_ignore in support of the existing event-subscription-based action instrumentation. Thanks Andreas Thurn for the contribution!

  • Use Module#prepend for ActiveRecord 5 Instrumentation

    Rails 5 deprecated the use of alias_method_chain in favor of using Module#prepend. Mixing Module#prepend and alias_method_chain can lead to a SystemStackError when an alias_method_chain is applied after a module has been prepended. This should ensure better compatibility between our ActiveRecord Instrumentation and other third party gems that modify ActiveRecord using Module#prepend.

  • Use license key passed in to NewRelic::Agent.manual_start

    Previously, the license key passed in when manually starting the agent with NewRelic::Agent.manual_start was not referenced when setting up the connection to report data to New Relic. This is now fixed.

  • Account for DataMapper database connection errors

    Our DataMapper instrumentation traces instances of DataObjects::SQLError being raised and removes the password from the URI attribute. However, when DataObjects cannot connect to the database (ex: could not resolve host), it will raise a DataObjects::ConnectionError. This inherits from DataObjects::SQLError but has nil for its URI attribute, since no connection has been made yet. To avoid the password check here on nil, the agent catches and re-raises any instances of DataObjects::ConnectionError explicitly. Thanks Postmodern for this contribution!

  • Account for request methods that require arguments

    When tracing a transaction, the agent tries to get the request object from a controller if it wasn't explicitly passed in. However, this posed problems in non-controller transactions with their own request methods defined that required arguments, such as in Resque jobs. This is now fixed.

Tuesday, November 8, 2016 - 13:36 Download


  • Datastore instance reporting for Redis, MongoDB, and memcached

    The agent now collects datastore instance information for Redis, MongoDB, and memcached. This information is displayed in transaction traces and slow query traces. For memcached only, multi requests will expand to individual server nodes, and the operation and key(s) will show in the trace details "Database query" section. Metrics for get_multi nodes will change slightly. Parent nodes for a get_multi will be recorded as generic segments. Their children will be recorded as datastore segments under the name get_multi_request and represent a batch request to a single Memcached instance.

  • Rescue errors from attempts to fetch slow query explain plans

    For slow queries through ActiveRecord 4+, the agent will attempt to fetch an explain plan on SELECT statements. In the event that this causes an error, such as being run on an adapter that doesn't implement exec_query, the agent will now rescue and log those errors. n

Tuesday, October 18, 2016 - 10:14 Download


  • Datastore instance reporting for ActiveRecord

    The agent now collects database instance information for ActiveRecord operations, when using the MySQL and Postgres adapters. This information (database server and database name) is displayed in transaction traces and slow query traces. For more information, see Ruby instance-level database information.

Tuesday, September 27, 2016 - 11:30 Download


  • Add :trace_only option to notice_error API

    Previously, calling notice_error would record the trace, increment the error count, and consider the transaction failing for Apdex purposes. This method now accepts a :trace_only boolean option which, if true, will only record the trace and not affect the error count or transaction.

  • HTTP.rb support

    The agent has been updated to add instrumentation support for the HTTP gem, including Cross Application Tracing. Thanks Tiago Sousa for the contribution!

  • Prevent redundant Delayed::Job instrumentation installation

    This change was to handle situations where multiple Delayed::Worker instances are being created but Delayed::Job has already been instrumented. Thanks Tony Brown for the contribution!

Monday, August 22, 2016 - 14:30 Download


  • Fix for "Unexpected frame in traced method stack" errors

    Our ActiveRecord 4.x instrumentation could have generated "Unexpected frame in traced method stack" errors when used outside of an active transaction (for example, in custom background job handlers). This has been fixed.

Monday, August 15, 2016 - 16:36 Download


  • Internal datastore instrumentation rewrites

    The agent's internal tracing of datastore segments has been rewritten, and instrumentation updated to utilize the new classes.

  • Fix Grape endpoint versions in transaction names

    Grape 0.16 changed Route#version (formerly #route_version) to possibly return an Array of versions for the current endpoint. The agent has been updated to use rack.env['api.version'] set by Grape, and fall back to joining the version Array with '|' before inclusion in the transaction name when api.version is not available. Thanks Geoff Massanek for the contribution!

  • Fix deprecation warnings from various Rails error subclasses

    Rails 5 deprecates #original_exception on a few internal subclasses of StandardError in favor of Exception#cause from Ruby stdlib. The agent has been updated to try Exception#cause first, thus avoiding deprecation warnings. Thanks Alexander Stuart-Kregor for the contribution!

  • Fix instrumentation for Sequel 4.35.0

    The latest version of Sequel changes the name and signature of the method that the Ruby Agent wraps for instrumentation. The agent has been updated to handle these changes. Users using Sequel 4.35.0 or newer should upgrade their agent.

  • Fix DataMapper instrumentation for additional versions

    Different versions of DataMapper have different methods for retrieving the adapter name, and Postmodern expanded our coverage. Thanks for the contribution!

Monday, June 27, 2016 - 11:48 Download


  • Official Rails 5.0 support

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

  • Early access Action Cable instrumentation

    The Ruby agent instruments Action Cable channel actions and calls to ActionCable::Channel#Transmit in Rails 5. Feedback is welcome!

  • Obfuscate queries from oracle_enhanced adapter correctly

    This change allows the oracle_enhanced adapter to use the same obfuscation as oracle adapters. Thanks Dan Drinkard for the contribution!

  • Make it possible to define a newrelic_role for deployment with Capistrano 3

    Thanks NielsKSchjoedt for the contribution!

  • Retry initial connection to New Relic in Resque master if needed

    Previously, if the initial connection to New Relic in a monitored Resque master process failed, the agent would not retry, and monitoring for the process would be lost. This has been fixed, and the agent will continue retrying in its background harvest thread until it successfully connects.

Monday, April 25, 2016 - 14:33 Download


  • Run explain plans on parameterized slow queries in AR4

    In our ActiveRecord 4 instrumentation, we moved to tracing slow queries using the payloads from ActiveSupport::Notifications sql.active_record events. As a result, we were unable to run explain plans on parameterized queries. This has now been updated to pass along and use the parameter values, when available, to get the explain plans.

  • Fix getMore metric grouping issue in Mongo 2.2.x instrumentation

    A metric grouping issue had cropped up when using the most recent Mongo gem (2.2.0) with the most recent release of the server (3.2.4). We now have a more future-proof setup for preventing these.

  • Restore older DataMapper support after password obfuscation fix

    Back in 3.14.3, we released a fix to avoid inadvertently sending sensitive information from DataMapper SQLErrors. Our implementation did not account for DataMapper versions below v0.10.0 not implementing the #options accessor. Thanks Bram de Vries for the fix to our fix!

  • Padrino 0.13.1 Support

    Users with Padrino 0.13.x apps were previously seeing the default transaction name "(unknown)" for all of their routes. We now provide the full Padrino route template in transaction names, including any parameter placeholders. Thanks Robert Schulze for the contribution!

  • Update transaction naming for Grape 0.16.x

    In Grape 0.16.x, route_ methods are no longer prefixed. Thanks to Daniel Doubrovkine for the contribution!

  • Fix name collision on method created for default metric name fix

    We had a name collision with the yard gem, which sets a class_name method on Module. We've renamed our internal method to derived_class_name instead.

Thursday, March 24, 2016 - 14:22 Download


  • Rack 2 alpha support

    This release includes experimental support for Rack 2 as of 2.0.0.alpha. Rack 2 is still in development, but the agent should work as expected for those who are experimenting with Rack 2.

  • Rails 5 beta 3 support

    We've tweaked our Action View instrumentation to accommodate changes introduced in Rails v5.0.0.beta3.

  • Defer referencing ::ActiveRecord::Base to avoid triggering its autoloading too soon

    In 3.12.1 and later versions of the agent, the agent references (and therefore loads) ActiveRecord::Base earlier on in the Rails loading process. This could jump ahead of initializers that should be run first. We now wait until ActiveRecord::Base is loaded elsewhere.

  • Fix explain plans for non-parameterized queries with single quote literals

    The agent does not run explain plans for queries still containing parameters (such as SELECT * FROM UNICORNS WHERE ID = $1 LIMIT 1). This check was unfortunately mutating the query to be obfuscated, causing an inability to collect an explain plan. This has now been fixed.

  • Fix default metric name for tracing class methods

    When using add_method_tracer on a class method but without passing in a metric_name_code, the default metric name will now look like Custom/ClassName/Class/method_name. We also addressed default metric names for anonymous classes and modules.

  • Fix issue when rendering SQL strings in developer mode

    When we obfuscate SQL statements, we rewrite the Statement objects as SQL strings inline in our sample buffers at harvest time. However, in developer mode, we also read out of these buffers when rendering pages. Depending on whether a harvest has run yet, the buffer will contain either Statement objects, SQL strings, or a mix. Now, developer mode can handle them all!

  • Fix DelayedJob Sampler reporting incorrect counts in Active Record 3 and below

    When fixing various deprecation warnings on ActiveRecord 4, we introduced a regression in our DelayedJob sampler which caused us to incorrectly report failed and locked job counts in ActiveRecord 3 and below. This is now fixed. Thanks Rangel Dokov for the contribution!

Wednesday, February 17, 2016 - 10:51 Download


  • Rails 5 support

    This release includes experimental support for Rails 5 as of 5.0.0.beta2. Please note that this release does not include any support for ActionCable, the WebSockets framework new to Rails 5.

  • Don't include extension from single format Grape API transaction names

    Starting with Grape 0.12.0, an API with a single format no longer declares methods with .:format, but with an extension such as .json. Thanks Daniel Doubrovkine for the contribution!

  • Fix warnings about shadowing outer local variable when running tests

    Thanks Rafael Almeida de Carvalho for the contribution!

  • Check config first for Rails middleware instrumentation installation

    Checking the config first avoids issues with mock classes that don't implement VERSION. Thanks Jesse Sanford for the contribution!

  • Remove a trailing whitespace in the template for generated newrelic.yml

    Thanks Paul Menzel for the contribution!

  • Reference external resources in comments and readme with HTTPS

    Thanks Benjamin Quorning for the contribution!

Tuesday, February 9, 2016 - 16:04 Download


  • Don't inadvertently send sensitive information from DataMapper SQLErrors

    DataObjects::SQLError captures the SQL query, and when using versions of data_objects prior to 0.10.8, built a URI attribute that contained the database connection password. The :query attribute now respects the obfuscation level set for slow SQL traces and splices out any password parameters to the URI when sending up traced errors to New Relic.

  • Improved SQL obfuscation algorithm

    To help standardize SQL obfuscation across New Relic language agents, we've improved the algorithm used and added more test cases.

  • Configurable longer sql_id attribute on slow SQL traces

    The sql_id attribute on slow SQL traces is used to aggregate normalized queries together. Previously, these IDs would generally be 9-10 digits long, due to a backend restriction. If slow_sql.use_longer_sql_id is set to true, these IDs will now be 18-19 digits long.

Monday, January 25, 2016 - 10:33 Download


  • Improved transaction names for Sinatra

    The agent will now use sinatra.route for transaction names on Sinatra 1.4.3+, which sets it in the request environment. This gives names that closer resemble the routes defined in the Sinatra DSL. Thanks to Brian Phillips for the suggestion!

  • Bugfix for error flag on transaction events

    There was an issue causing the error flag to always be set to false for Insights transaction events that has been fixed.

  • Official support for Sidekiq 4

    The Ruby agent now officially supports Sidekiq 4.

  • Additional attributes collected

    The agent now collects the following information in web transactions: Content-Length HTTP response and Content-Type HTTP request headers.

Thursday, December 10, 2015 - 12:41 Download


  • Add support for setting a display name on hosts

    You can now configure a display name for your hosts using process_host.display_name, to more easily distinguish dynamically assigned hosts. For more info, see Change display name of hosts

  • Fixes automatic middleware instrumentation for Puma 2.12.x

    Starting with version 2.12.x the Puma project inlines versions of Rack::Builder and Rack::URLMap under the Puma namespace. This had the unfortunate side effect of breaking automatic Rack middleware instrumentation. We now instrument Puma::Rack::Builder and Puma::Rack::URLMap and once again have automatic Rack middleware instrumentation for applications running on Puma.

  • Do not use a DelayedJob's display_name for naming the transaction

    A DelayedJob's name may be superseded by a display_name, which can lead to a metric grouping issue if the display_name contains unique identifiers. We no longer use job name methods that may lead to an arbitrary display_name. Instead, we use the appropriate class and/or method names, depending what makes sense for the job and how it's called.

  • Improvements to Mongo 2.1.x instrumentation

    Fixes issue where getMore operations in batched queries could create metric grouping issues. Previously when multiple Mongo queries executed in the same scope only a single query was recorded as part of a transaction trace. Now transaction trace nodes will be created for every query executed during a transaction.

  • Bugfix for NewRelic::Agent.notice_error

    Fixes issue introduced in v3.14.0 where calling NewRelic::Agent.notice_error outside of an active transaction results in a NoMethodError.

  • Bugfix for Resque Transaction Error events

    Fixes error preventing Transaction Error events generated in Resque tasks from being sent to New Relic.

Monday, October 19, 2015 - 11:32 Download


  • pruby marshaller removed

    The deprecated pruby marshaller has now been removed; the marshaller config option now only accepts json. Customers still running Ruby 1.8.7/REE must add the json gem to their Gemfile, or (preferably) upgrade to Ruby 1.9.3 or higher.

  • Log dates in ISO 8601 format

    The agent will now log dates in ISO 8601 (YYYY-MM-DD) format, instead of MM/DD/YY.

  • Additional attributes collected

    The agent now collects the following information in web transactions: Accept, Host, User-Agent, Content-Length HTTP request headers, HTTP request method, and Content-Type HTTP response header.

  • TransactionErrors reported for APM error advanced analytics

    With this release, the agent reports TransactionError events. These new events power the beta feature Advanced Analytics for APM errors. The error events are also available today through New Relic Insights.

    Advanced Analytics for APM errors lets you see all of your errors, with granular detail. Filter and group by any attribute to analyze them. Take action to resolve issues through collaboration.

    For more information, see View APM errors and error traces.

Monday, September 28, 2015 - 10:28 Download

Bug Fixes

  • Don't fail to send data when using mathn library

    Version 3.12.1 introduced a bug with applications using the mathn library that would prevent the agent from sending data to New Relic. This has been fixed.