Importante
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.
See the New Relic Ruby agent EOL policy for information about agent releases and support dates.
v9.3.0
Version 9.3.0 of the agent adds log-level filtering, adds custom attributes for log events, and updates instrumentation for Action Cable. It also provides fixes for how Fiber
args are treated, Code-Level Metrics, unnecessary files being included in the gem, and NewRelic::Agent::Logging::DecoratingFormatter#clear_tags!
being incorrectly private.
Feature: Filter forwarded logs based on level
Previously, all log events, regardless of their level, were forwarded to New Relic when log forwarding was enabled. Now, you may specify the lowest log level you'd like forwarded to New Relic.
Configuration name Default Behavior Valid values application_logging.forwarding.log_level
debug
Sets the minimum log level for events forwarded to New Relic debug
,info
,warn
,error
,fatal
,unknown
This setting uses Ruby's Logger::Severity constants integer values to determine precedence.
Feature: Custom attributes for logs
You can now add custom attributes to log events forwarded to New Relic! You can pass these attributes using an API and/or a configuration option.
Configuration name Default Behavior application_logging.forwarding.custom_attributes
{}
A hash with key/value pairs to add as custom attributes to all log events forwarded to New Relic. If sending using an environment variable, the value must be formatted like: "key1=value1,key2=value2"
Call the API using NewRelic::Agent.add_custom_log_attributes
and passing your attributes as a hash. For example, you could call: NewRelic::Agent.add_custom_log_attributes(dyno: ENV['DYNO'], pod_name: ENV['POD_NAME'])
, to add the attributes dyno
and pod_name
to your log events.
Attributes passed to the API or the configuration will be added to all log events.
Thanks to @rajpawar02 for raising this issue and @askreet for helping us with the solution. Issue#1141, PR#2084, PR#2087
Feature: Instrument transmit_subscription-related Action Cable actions
This change subscribes the agent to the Active Support notifications for:
transmit_subscription_confirmation.action_cable
transmit_subscription_rejection.action_cable
Bugfix: Removed unwanted files from being included in file_list in gemspec
Previously, the agent was including some files in the gem that were not needed but added to the size of the gem. These files will no longer be included. Thanks to @manuraj17 for the contribution! PR#2089
Bugfix: Report Code-Level Metrics for Rails controller methods
Controllers in Rails automatically render views with names that correspond to valid routes. This means that a controller method may not have a corresponding method in the controller class. Code-Level Metrics now report on these methods and don't log false warnings. Thanks to @jcrisp for reporting this issue. PR#2061
Bugfix: Code-Level Metrics for ActiveRecord models
Classes that inherit from ActiveRecord were not reporting Code-Level Metrics due to an error in the agent when identifying the class name. This has been fixed and Code-Level Metrics will now report for ActiveRecord models. Thanks to @abigail-rolling for reporting this issue. PR#2092.
Bugfix: Private method
clear_tags!
for NewRelic::Agent::Logging::DecoratingFormatterAs part of a refactor included in a previous release of the agent, the method
NewRelic::Agent::Logging::DecoratingFormatter#clear_tags!
was incorrectly made private. This method is now public again. Thanks to @dark-panda for reporting this issue. PR#Bugfix: Fix the way args are handled for Fibers
Previously, the agent treated Fiber args the same as it was treating Thread args, which is not correct. Args are passed to
Fiber#resume
, and notFiber.new
. This has been fixed, and the agent will properly preserve args for both Fiber and Thread classes. This also caused an error to occur when using Async 2.6.2, due to mismatching initalize definitions for Fiber prepended modules. This has been fixed as well. Thanks to @travisbell for bringing this to our attention. PR#2083
Importante
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.
See the New Relic Ruby agent EOL policy for information about agent releases and support dates.
v9.2.2
Version 9.2.2 of the agent fixes a bug with the Transaction#finished?
method.
Bugfix: Transaction#finished? no longer throws a NoMethodError when initial_segment is nil
This change adds a safe navigation operator to
Transaction#finished?
to preventNoMethodErrors
when a transaction does not have any segments. Our thanks goes to @JulienDefrance for reporting this issue. PR#1983
Importante
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.
See the New Relic Ruby agent EOL policy for information about agent releases and support dates.
v9.2.1
Version 9.2.1 fixes a bug causing the agent to continue storing data on finished transactions, and a bug preventing errors from being expected.
Bugfix: Finished transactions continue to store data on different threads
Previously, when a new thread was spawned the agent would continue using the current transaction to record data on, even if this transaction had finished already in a different thread. Now the agent will only use the current transaction in the new thread if it is not yet finished. Thank you to @fcheung for reporting this bug and providing us with an extremely helpful reproduction to debug. PR#1969
Bugfix: Expected Errors passed to notice_error are expected again
A bug was introduced in 9.1.0 that caused to agent not to mark errors as expected if the error was passed in to
notice_error
using theexpected: true
parameter. This has been fixed and errors will now be marked as expected, as expected. Thank you very much to @eiskrenkov for finding this bug and contributing a fix for it! PR#1954
Importante
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.
See the New Relic Ruby agent EOL policy for information about agent releases and support dates.
v9.2.0
Version 9.2.0 of the agent introduces some performance improvements for working with high numbers of nested actions, and deprecates instrumentation for the memcached
and memcache-client
gems (with dalli
still being supported).
Feature: Enhance performance for handling high numbers of nested actions
With Issue#1910, community members @parkerfinch and @travisbell informed us of some CPU spikes and process hangs seen only when using the agent's thread instrumentation, which was enabled by default with v9.0. When thread instrumentation is enabled, instrumented actions taking place within threads are seen and reported on by the agent whereas they would have previously gone unnoticed. This is a great improvement to the agent's usefulness in an async context, and also makes it easier for higher numbers of nested actions to be observed. For example, if an instrumented background job framework (Sidekiq, Resque) kicks off a job that the agent notices and then that job in turn performs actions such as database queries that the agent also instruments, nested actions are seen. However, with very high (10,000+) numbers of actions nested within a single instrumented outer action, the agent would struggle to efficiently crunch through all of the collected data at the time when the outer action finished. The agent should now be much more efficient when any observed action with lots of nested actions is finished. Our performance testing was conducted with hundreds of thousands of nested actions taking place, and we hope that the benefits of thread tracing can now be enjoyed without any drawbacks. Thanks very much @parkerfinch and @travisbell! PR#1927
Feature: Deprecate memcached and memcache-client instrumentation
Instrumentation for the memcached and memcache-client libraries is deprecated and will be removed during the next major release.
Importante
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 at most 90 days old. Read more about keeping agents up to date.
See the New Relic Ruby agent EOL policy for information about agent releases and support dates.
v9.1.0
Version 9.1.0 of the agent delivers support for two new errors inbox features: error fingerprinting and user tracking, identifies the Amazon Timestream data store, removes Distributed Tracing warnings from agent logs when using Sidekiq, fixes bugs, and is tested against the recently released JRuby 9.4.2.0.
Feature: Error fingerprinting - supply your own errors inbox group names
Are your error occurrences grouped poorly? Set your own error fingerprint via a callback function. A new
set_error_group_callback
public API method has been added that will accept a user defined proc. The proc will be invoked for each noticed error and whenever it returns a string, that string will be used as the error group name for the error and will take precedence over any server-side grouping that takes place with the New Relic errors inbox. This gives users much greater control over the grouping of their errors.The customer defined proc will be expected to receive exactly one input argument, a hash. The hash contains the following:
Key Value :error
The Ruby error class instance. Offers #class
,#message
, and#backtrace
:customAttributes
Any customer defined custom attributes for the current transaction :'request.uri'
The current request URI if available :'http.statusCode'
The HTTP status code (200, 404, etc.) if available :'http.method'
The HTTP method (GET, PUT, etc.) if available :'error.expected'
Whether (true) or not (false) the error was expected :'options'
The options hash passed to NewRelic::Agent.notice_error
The callback only needs to be set once per initialization of the New Relic agent.
Example usage:
proc = proc { |hash| "Access" if hash[:'http.statusCode'] == 401 }NewRelic::Agent.set_error_group_callback(proc)Feature: User tracking - associate errors with a user id
You can now see the number of users impacted by an error group. Identify the end user with a new
set_user_id
public API method that will accept a string representation of a user id and associate that user id with the current transaction. Transactions and errors will then have a newenduser.id
agent attribute associated with them. This will allow agent users to tag transactions and errors as belonging to given user ids in support of greater filtering and alerting capabilities.Identify Amazon Timestream when the amazon_timestream AR adapter is used
When the agent sees the activerecord-amazon-timestream-adapter gem being used, it will now identify the data store as "Timestream". Thanks very much to @wagner for contributing this enhancement! PR#1872
Bugfix: Remove Distributed Tracing related warnings from agent logs when headers are not present in Sidekiq
Previously, the agent would log a warning to
newrelic_agent.log
every time it attempted to accept empty Distributed Tracing headers from Sidekiq jobs which could result in an excessive number of warnings. Now the agent will no longer create these warnings when using Sidekiq. PR#1834Bugfix: Log request headers in debug-level logs instead of human-readable Objects
Previously, the agent sometimes received children of the
NewRelic::Agent::HTTPClients::AbstractRequest
class as an argument whenNewRelic::Agent::Transaction::DistributedTracers#log_request_headers
was called. This caused debug-level log messages that print the request headers to show human-readable Objects (ex.#<NewRelic::Agent::HTTPClients::HTTPClientRequest:0x00007fd0dda983e0>
) instead of the request headers. Now, the hash of the request headers should always be logged. PR#1839Bugfix: Fix undefined method
controller_path
logged in Action Controller InstrumentationPreviously, the agent could log an error when trying to determine the metric name in the Action Controller instrumentation if the controller class did not respond to
controller_path
. This has been resolved and the agent will no longer call this method unless the class responds to it. Thank you to @gsar for letting us know about this issue. PR#1844Bugfix: Fix Transaction#finish exception and decrease log level for related warning during async transactions
Previously, the agent would raise a non-fatal error when a segment without a parent was unfinished when the transaction completed. This error was raised while constructing a
warn
-level log message. Now that Thread instrumentation is on by default, this log message emits more frequently and is less concerning. In cases where we see a Thread, Fiber, or concurrent-ruby segment in a transaction, the message will be degraded to adebug
-level. Thanks to @NielsKSchjoedt for creating the issue and @boomer196 for testing solutions. PR#1876CI: Target JRuby 9.4.2.0
The agent is now actively being tested against JRuby 9.4.2.0. NOTE that this release does not contain any non-CI related changes for JRuby. Old agent versions are still expected to work with newer JRubies and the newest agent version is still expected to work with older JRubies.
Importante
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 at most 90 days old. Read more about keeping agent up to date.
As of this release, the oldest supported version is 6.10.0
v9.0.0
Version 9.0.0 of the agent removes several deprecated configuration options and API methods, enables Thread tracing by default, adds Fiber instrumentation, removes support for Ruby versions 2.2 and 2.3, removes instrumentation for several deprecated gems, changes how the API method set_transaction_name
works, and updates rails_defer_initialization
to be an environment variable only configuration option.
Remove deprecated configuration options
The following configuration options have been removed and will no longer work. Please update all configs to use the replacements listed below. PR#1782
Removed | Replacement |
|
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Enable Thread instrumentation by default
The configuration option
instrumentation.thread.tracing
is now enabled by default. This configuration allows the agent to properly monitor code occurring inside threads. In Ruby agent 9.0, instrumented code within threads will be recorded and associated with the current transaction when the thread was created.This may be a breaking change if you are currently using custom thread instrumentation. New transactions inside of threads will no longer be started if one already exists. PR#1767
Add Fiber instrumentation
Fiber
instances are now automatically instrumented similarly toThread
instances. This can be configured usinginstrumentation.fiber
. PR#1802Removed support for Ruby 2.2 and 2.3
Ruby 2.2 and 2.3 are no longer supported by the Ruby agent. To continue using the latest Ruby Agent version, please update to Ruby 2.4.0 or above. PR#1778
Removed deprecated instrumentation
Instrumentation for the following gems had been previously deprecated and has now been removed. PR#1788
- Acts As Solr
- Authlogic
- DataMapper
- Rainbows
- Sunspot
Versions of the following technologies had been previously deprecated and are no longer supported.
- Passenger: 2.2.x - 4.0.x
- Puma: 2.0.x
- Grape: 0.2.0
- Padrino: 0.14.x
- Rails: 3.2.x
- Sinatra: 1.4.x, 1.5.x
- Mongo: 1.8.x - 2.3.x
- Sequel: 3.37.x, 4.0.x
- Delayed_Job: 2.0.x - 4.0.x
- Sidekiq: 4.2.x
- Excon: below 0.55.0
- HttpClient: 2.2.0 - 2.8.0
- HttpRb: 0.9.9 - 2.2.1
- Typhoeus: 0.5.3 - 1.2.x
- Bunny: 2.0.x - 2.6.x
- ActiveMerchant: 1.25.0 - 1.64.x
Updated API method
set_transaction_name
When the method
NewRelic::Agent.set_transaction_name
is called, it will now always change the name and category of the currently running transaction to what is passed into the method. This is a change from previous agent versions.Previously, if
set_transaction_name
was called with a new transaction name and a new category that did not match the category already assigned to a transaction, neither the new name nor category would be saved to the transaction. If this method is being called in a situation in which it was previously ignored due to category differences, this will now change the name and category of the transaction. PR#1797Removed API method:
NewRelic::Agent.disable_transaction_tracing
The deprecated API method
NewRelic::Agent.disable_transaction_tracing
has been removed. Instead use eitherNewRelic::Agent#ignore_transaction
to disable the recording of the current transaction orNewRelic::Agent.disable_all_tracing
to yield a block without collecting any metrics or traces in any of the subsequent calls. PR#1792Renamed ActiveJob metrics
Previously, ActiveJob was categorized as a message broker, which is inaccurate. We've updated the naming of ActiveJob traces from leading with
MessageBroker/ActiveJob
to simply leading withActiveJob
. PR#1811Code cleanup
Thank you to community member @esquith for contributing some cleanup of orphaned constants in our code base. PR#1793 PR#1794 PR#1808
Community member @fchatterji helped standardize how we reference
NewRelic
throughout our codebase PR#1795 and updated our README's community header PR#1815. Thanks fchatterji!Bugfix: Allow rails initialization to be deferred by environment variable
The Ruby agent may force some Rails libraries to load on agent initialization, preventing some settings defined in
config/initializers
from being applied. Changing the initialization process to run afterconfig/initializers
, however, may break the configuration for other gems (ex. Roadie Rails).For those having troubles with agent initialization and Rails initializers, you can now pass the environment variable
NEW_RELIC_DEFER_RAILS_INITIALIZATION=true
to make the agent initialize afterconfig/initializers
are run. This config option can only be set using an environment variable and can't be set using YAML. PR#1791Thanks to @jdelStrother for bringing this issue to our attention and testing our fixes along the way. Issue#662
Importante
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 at most 90 days old. Read more about keeping agent up to date.
As of this release, the oldest supported version is 6.9.0.363
v8.16.0
Version 8.16.0 introduces more Ruby on Rails instrumentation (especially for Rails 6 and 7) for various Action*/Active* libraries whose actions produce Active Support notifications events.
Add Various Ruby on Rails Library Instrumentations
New instrumentation is now automatically provided by several Action*/Active* libaries that generate Active Support notifications. With each Ruby on Rails release, new the Rails libraries add new events and sometimes existing events have their payload parameters updated as well. The New Relic Ruby agent will now automatically process more of these events and parameters with New Relic segments created for each event. At a minimum, each segment gives timing information for the event. In several cases, all non-sensitive event payload parameters are also passed along in the segment.
The agent now newly supports or has updated support for the following libraries:
- Action Cable (for WebSockets) PR#1749
- Action Controller (for the 'C' in MVC) PR#1744
- Action Mailbox (for sending mail) PR#1740
- Action Mailer (for routing mail) PR#1740
- Active Job (for background jobs) PR#1742
- Active Support (for caching operations) PR#1742
The instrumentations for each of these libaries are all enabled by default, but can be independently disabled via configuration by using the following parameters:
Configuration name Default Behavior disable_action_cable
false
If true
, disables Action Cable instrumentation.disable_action_controller
false
If true
, disables Action Controller instrumentation.disable_action_mailbox
false
If true
, disables Action Mailbox instrumentation.disable_action_mailer
false
If true
, disables Action Mailer instrumentation.disable_activejob
false
If true
, disables Active Job instrumentation.disable_active_support
false
If true
, disables Active Support instrumentation.
Importante
We recommend updating to the latest agent version as soon as it's available. If you are prevented from upgrading to the latest version, ensure that your agents are updated to a version at most 90 days old. Read more about keeping your agent up to date.
As of this release, the oldest supported version is 6.9.0.363
v8.15.0
Version 8.15.0 of the agent confirms compatibility with Ruby 3.2.0, adds instrumentation for concurrent-ruby, and confirms Sinatra 3 compatibility with Padrino 0.15.2. It also enables batching and compression for Infinite Tracing.
Add Support for Ruby 3.2.0
Following the 3.2.0 release of Ruby, the New Relic Ruby agent has confirmed compatibility with and now supports the official release of Ruby 3.2.0. PR#1715
Add instrumentation for concurrent-ruby
The agent now instruments the concurrent-ruby gem for versions 1.1.5 and above. This instrumentation provides visibility inside blocks passed to many of the gem's API methods, including
Concurrent::Promises.future
andConcurrent::Future.execute
.
Configuration name | Default | Behavior |
---|---|---|
instrumentation.concurrent_ruby | auto | Controls auto-instrumentation of the concurrent-ruby library at start up. May be one of auto , prepend , chain , disabled . |
Infinite Tracing: Use batching and compression
For Infinite Tracing, which Ruby applications can leverage with the
newrelic-infinite_tracing
gem, payloads will now be batched and compressed to signficantly decrease the amount of outbound network traffic. PR#1723
Configuration name | Default | Behavior | |||
---|---|---|---|---|---|
infinite_tracing.batching | true | If true (the default), the Trace Observer will receive data in batches instead of sending each span individually | |||
infinite_tracing.compression_level | high | Configure the compression level for data sent to the trace observer. May be one of [none | low | medium | high]. 'high' is the default. Set the level to 'none' to disable compression. |
Importante
We recommend updating to the latest agent version as soon as it's available. If your organization has established practices that prevent you from upgrading to the latest version, ensure that your agents are regularly updated to a version at most 90 days old. Read more about keeping your agent up to date.
As of this release, the oldest supported version is 6.8.0.359
v8.14.0
Version 8.14.0 of the agent restores desired Capistrano-based changelog lookup functionality when a deployment is performed, speeds up GUID generation, delivers support for instrumenting Rails custom event notifications, fixes potential compatibility issues with the RedisClient gem, and fixes bugs related to initialization in Rails.
Deployment Recipe: Restore desired Capistrano-based changelog lookup behavior
The New Relic Ruby agent offers a Capistrano recipe for recording app deployments. The recipe code was significantly cleaned up with PR#1498 which inadvertently changed the way the recipe handles the changelog for a deployment. Community member @arthurwozniak spotted and corrected this change in order to restore the desired changelog lookup functionality while retaining all of the previous cleanup. Thank you very much for your contribution, @arthurwozniak! PR#1653
Speed up GUID generation
The agent leverages random numbers in its GUID (globally unique identifier) generation and would previously always freshly calculate the result of 16^16 or 32^32 before generating a random number. Given that those 16^16 and 32^32 operations are expected, it makes sense to calculate their results up front and store them in constants to be referred to later. Doing so has resulted in a performance gain for the generation of GUIDs. Many thanks to @tungmq for contributing this optimisation and the benchmarks to support it! PR#1693
Support for Rails ActiveSupport::Notifications for custom events
When the new
active_support_custom_events_names
configuration parameter is set equal to an array of custom event names to subscribe to, the agent will now subscribe to each of the names specified and report instrumentation for the events when they take place. Creating custom events is simple and now reporting instrumentation for them to New Relic is simple as well. PR#1659Bugfix: Support older versions of the RedisClient gem, handle unknown Redis database index
With version 8.13.0 of the agent, support was added for the redis-rb gem v5+ and the new RedisClient gem. With versions of RedisClient older than v0.11, the agent could cause the monitored application to crash when attempting to determine the Redis database index. Version 8.14.0 adds two related improvements. Firstly, support for RedisClient versions older than v0.11 has been added to get at the database index value. Secondly, the agent will no longer crash or impact the monitored application in the event that the database index cannot be obtained. Thank you very much to our community members @mbsmartee and @patatepartie for bringing this issue to our attention, for helping us determine how to best reproduce it, and for testing out the update. We appreciate your help! Issue#1650 PR#1673
Bugfix: Defer agent startup in Rails until after application-defined initializers have runIn Rails, the agent previously loaded before any application-defined initializers. This allowed initializers to reference theadd_method_tracer
API. However, this had the side-effect of forcing some framework libraries to load before initializers ran, preventing any configuration values related to these libraries from being applied. This fix provides an option to split initialization into two parts: loadadd_method_tracer
before application-defined initializers and start the agent after application-defined initializers. This may cause other initializers to behave differently.If you'd like to use this feature, setdefer_rails_initialization
totrue
. It isfalse
by default, but may becometrue
by default in a future release.Furthermore, our Action View instrumentation was missing anActiveSupport.on_load
block around the code that loads our instrumentation.Thank you @jdelStrother for bringing this to our attention and collaborating with us on a fix. PR#1658Unfortunately, this bugfix is unreachable as written because the configuration value used to access the bugfix won't be applied until after initialization. Follow along for updates at Issue#662.
Importante
We recommend updating to the latest agent version as soon as it's available. If your organization has established practices that prevent you from upgrading to the latest version, ensure that your agents are regularly updated to a version at most 90 days old. Read more about keeping your agent up to date.
As of this release, the oldest supported version is 6.8.0.359
v8.13.1
Version 8.13.1 of the agent provides a bugfix for Redis v5.0 instrumentation.
Fix NoMethodError when using Sidekiq v7.0 with Redis Client v0.11
In some cases, the
RedisClient
object cannot directly access methods like db, port, or path. These methods are always available on theclient.config
object. This raised aNoMethodError
in environments that used Sidekiq v7.0 and Redis Client v0.11. Thank you to fcheung and @stevenou for bringing this to our attention! Issue#1639