v8.7.0
APM logs-in-context log forwarding on by default
Automatic application log forwarding is now enabled by default. This version of the agent will automatically send enriched application logs to New Relic. To learn more about about this feature see here, and additional configuration options are available here. To learn about how to toggle log ingestion on or off by account see here.
Improved async support and Thread instrumentation
Previously, the agent was not able to record events and metrics inside Threads created inside of an already running transaction. This release includes 2 new configuration options to support multithreaded applications to automatically instrument threads. A new configuration option,
instrumentation.thread.tracing
(disabled by default), has been introduced that, when enabled, will allow the agent to insert New Relic tracing inside of all Threads created by an application. To support applications that only want some threads instrumented by New Relic, a new class is available,NewRelic::TracedThread
, that will create a thread that includes New Relic instrumentation, see our API documentation for more details.New configuration options included in this release:
Configuration name Default Behavior instrumentation.thread
auto
(enabled)Allows the agent to correctly nest spans inside of an asyncronous transaction. instrumentation.thread.tracing
false
(disabled)Automatically add tracing to all Threads created in the application. This may be enabled by default in a future release. We'd like to thank @mikeantonelli for sharing a gist with us that provided our team with an entry point for this feature.
Deprecate support for Ruby 2.2
Ruby 2.2 reached end of life on March 31, 2018. The agent has deprecated support for Ruby 2.2 and will make breaking changes for this version in its next major release.
Added updated configuration options for transaction events and deprecated previous configs
This release deprecates the following instrumentation:
Deprecated Replacement ActiveMerchant 1.64.0 or lower ActiveMerchant 1.65.0 or higher ActiveRecord 3.2.22.5 or lower ActiveRecord 4.0.0 or higher Acts As Solr (all versions) none Authlogic (all versions) none Bunny 2.6.7 or lower Bunny 2.7.0 or higher Dalli 2.7.6 or lower Dalli 2.7.7 or higher DataMapper (all versions) none Delayed Job 4.1.2 or lower Delayed Job 4.1.3 or higher Excon 0.55.0 or lower Excon 0.56.0 or higher Grape 0.19.1 or lower Grape 0.19.2 or higher HTTPClient 2.8.2.4 or lower HTTPClient 2.8.3 HTTP.rb 2.2.1 or lower HTTP.rb 2.2.2 or higher Mongo 2.4.0 or lower Mongo 2.4.1 or higher Padrino 0.14.4 or lower Padrino 0.15.0 or higher Passenger 5.1.2 or lower Passenger 5.1.3 or higher Puma 3.8.2 or lower Puma 3.9.0 or higher Rack 1.6.7 or lower Rack 1.6.8 or higher Rails 3.2.22.5 or lower Rails 4.0.0 or higher Rainbows (all versions) none Sequel 4.44.0 or lower Sequel 4.45.0 or higher Sidekiq 4.2.10 or lower Sidekiq 5.0.0 or higher Sinatra 1.4.8 or lower Sinatra 2.0.0 or higher Sunspot (all versions) none Typhoeus 1.1.2 or lower Typhoeus 1.3.0 or higher Unicorn 5.2.0 or lower Unicorn 5.3.0 or higher For the gems with deprecated versions, we will no longer test those versions in our multiverse suite. They may, however, still be compatible with the agent. We will no longer fix bug reports for issues with these versions of the gem.
Internally leverage
Object.const_get
andObject.const_defined?
When dynamically checking for or obtaining a handle to a class constant from a string, leverage the
Object
class's built in methods wherever possible to enjoy simpler, more performant operations. All JRubies and CRubies v2.5 and below need a bit of assistance beyond whatObject
can provide given that those Rubies may yield an unwanted constant from a different namespace than the one that was specified. But for all other Rubies and even for those Rubies in contexts where we can 100% trust the string value coming in, leverage theObject
class's methods and reap the benefits.Clarify documentation for
rake.tasks
configurationThe
rake.tasks
description in the defaultnewrelic.yml
file and the New Relic Ruby Agent Configuration docs have been updated to clarify its behavior and usage. The documentation now reads:Specify an array of Rake tasks to automatically instrument. This configuration option converts the Array to a RegEx list. If you'd like to allow all tasks by default, use
rake.tasks: [.+]
. Rake tasks will not be instrumented unless they're added to this list. For more information, visit the (New Relic Rake Instrumentation docs)[/docs/apm/agents/ruby-agent/background-jobs/rake-instrumentation].We thank @robotfelix for suggesting these changes.
Enable Environment Variables setting Array configurations to be converted to Arrays
Prior to this change, when comma-separated lists were passed as environment variables, an error would be emitted to the
newrelic_agent.log
and a String would be set as the value. Now, Arrays will be accurately coerced.Bugfix: Allow TransactionEvents to be sampled at the expected rate
The
transaction_events.max_samples_stored
capacity value within the TransactionEventAggregator did not match up with its expected harvest cycle interval, causing TransactionEvents to be over-sampled. This bugfix builds upon the updates made in #952 so that the interval and capacity behave as expected for the renamedtransaction_events*
configuration options.Bugfix: Error events missing attributes when created outside of a transaction
Previously the agent was not assigning a priority to error events that were created by calling notice_error outside the scope of a transaction. This caused issues with sampling when the error event buffer was full, resulting in a
NoMethodError: undefined method '<' for nil:NilClass
in the newrelic_agent.log. This bugfix ensures that a priority is always assigned on error events so that the agent will be able to sample these error events correctly. Thank you to @olleolleolle for bringing this issue to our attention.
Support statement
New Relic recommends that you upgrade the agent regularly and at a minimum every 3 months. As of this release, the oldest supported version is 5.7.0.350.
v8.6.0
Telemetry-in-Context: Automatic Application Logs, a quick way to view logs no matter where you are in the platform
- Adds support for forwarding application logs to New Relic. This automatically sends application logs that have been enriched to power Telemetry-in-Context. This is disabled by default in this release. This may be on by default in a future release.
- Adds support for enriching application logs written to disk or standard out. This can be used with another log forwarder to power Telemetry-in-Context if in-agent log forwarding is not desired. We recommend enabling either log forwarding or local log decorating, but not both features. This is disabled by default in this release.
- Improves speed and Resque support for logging metrics which shows the rate of log message by severity in the Logs chart in the APM Summary view. This is enabled by default in this release.
To learn more about Telemetry-in-Context and the configuration options please see the documentation here.
Bugfix: Curb - satify method_with_tracing's verb argument requirement
When Curb instrumentation is used (either via prepend or chain), be sure to always pass the verb argument over to
method_with_tracing
which requires it. Thank you to @knarewski for bringing this issue to our attention, for providing a means of reproducing an error, and for providing a fix. That fix has been replicated by the agent team with permission. See Issue 1033 for more details.Improve the usage of the 'hostname' executable and other executables
In all places where a call to an executable binary is made (currently this is done only for the 'hostname' and 'uname' binaries), leverage a new helper method when making the call. This new helper will a) not attempt to execute the binary if it cannot be found, and b) prevent STDERR/STDOUT content from appearing anywhere except New Relic's own logs if the New Relic logger is set to the 'debug' level. When calling 'hostname', fall back to
Socket.gethostname
if the 'hostname' binary cannot be found. When calling 'uname', fall back on using a value of 'unknown' if the 'uname' command fails. Many thanks to @metaskills and @brcarp for letting us know that Ruby AWS Lambda functions can't invoke 'hostname' and for providing ideas and feedback with Issue #697.Documentation: remove confusing duplicate RUM entry from newrelic.yml
The
browser_monitoring.auto_instrument
configuration option to enable web page load timing (RUM) was confusingly listed twice in the newrelic.yml config file. This option is enabled by default. The newrelic.yml file has been updated to list the option only once. Many thanks to @robotfelix for bringing this to our attention with Issue #955.Bugfix: fix unit test failures when New Relic environment variables are present
Previously, unit tests would fail with unexpected invocation errors when
NEW_RELIC_LICENSE_KEY
andNEW_RELIC_HOST
environment variables were present. Now, tests will discard these environment variables before running.
Support statement
New Relic recommends that you upgrade the agent regularly and at a minimum every 3 months. As of this release, the oldest supported version is 6.3.0.355.
v8.5.0
AWS: Support IMDSv2 by using a token with metadata API calls
When querying AWS for instance metadata, include a token in the request headers. If an AWS user configures instances to require a token, the agent will now work. For instances that do not require the inclusion of a token, the agent will continue to work in that context as well.
Muffle anticipated stderr warnings for "hostname" calls
When using the
hostname
binary to obtain hostname information, redirect STDERR to /dev/null. Thanks very much to @frenkel for raising this issue on behalf of OpenBSD users everywhere and for providing a solution with PR #965.Added updated configuration options for transaction events and deprecated previous configs This release deprecates and replaces the following configuration options:
Deprecated | Replacement |
---|---|
event_report_period.analytic_event_data | event_report_period.transaction_event_data |
analytics_events.enabled | transaction_events.enabled |
analytics_events.max_samples_stored | transaction_events.max_samples_stored |
Eliminated warnings for redefined constants in ParameterFiltering
Fixed the
ParameterFiltering
constant definitions so that they are not redefined on multiple reloads of the module. Thank you to @TonyArra for bringing this issue to our attention.Docker for development
Docker and Docker Compose may now be used for local development and testing with the provided
Dockerfile
anddocker-compose.yml
files in the project root. See DOCKER.md for usage instructions.
Bugfix: Rails 5 + Puma errors in rack "can't add a new key into hash during iteration"
When using rails 5 with puma, the agent would intermittently cause rack to raise a
RuntimeError: can't add a new key into hash during iteration
. We have identified the source of the error in our instrumentation and corrected the behavior so it no longer interferes with rack. Thanks to @sasharevzin for bringing attention to this error and providing a reproduction of the issue for us to investigate.CI: target JRuby 9.3.3.0
Many thanks to @ahorek for PR #919, PR #921, and PR #922 to keep us up to date on the JRuby side of things. The agent is now actively being tested against JRuby 9.3.3.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.
CI: Update unit tests for Rails 7.0.2
Ensure that the 7.0.2 release of Rails is fully compatible with all relevant tests.
CI: Ubuntu 20.04 LTS
To stay current and secure, our CI automation is now backed by version 20.04 of Ubuntu's long term support offering (previously 18.04).
v8.4.0
Provide basic support for Rails 7.0
This release includes Rails 7.0 as a tested Rails version. Updates build upon the agent's current Rails instrumentation and do not include additional instrumentation for new features.
Improve the performance of NewRelic::Agent::GuidGenerator#generate_guid
This method is called by many basic operations within the agent including transactions, datastore segments, and external request segments. Thank you, @jdelstrother for contributing this performance improvement!
Documentation: Development environment prep instructions
The multiverse collection of test suites requires a variety of data handling software (MySQL, Redis, memcached, etc.) to be available on the machine running the tests. The project documentation has been updated to outline the relevant software packages, and a
Brewfile
file has been added to automate software installation with Homebrew.Bugfix: Add ControllerInstrumentation::Shims to Sinatra framework
When the agent is disabled by setting the configuration settings
enabled
,agent_enabled
, and/ormonitor_mode
to false, the agent loads shims for public controller instrumentation methods. These shims were missing for the Sinatra framework, causing applications to crash if the agent was disabled. Thank you, @NC-piercej for bringing this to our attention!
Support statement
New Relic recommends that you upgrade the agent regularly and at a minimum every 3 months. As of this release, the oldest supported version is 5.7.0.350.
v8.3.0
Updated the agent to support Ruby 3.1.0
Most of the changes involved updating the multiverse suite to exclude runs for older versions of instrumented gems that are not compatible with Ruby 3.1.0. In addition, Infinite Tracing testing was updated to accommodate
YAML::unsafe_load
for Psych 4 support.Bugfix: Update AdaptiveSampler#sampled? algorithm
One of the clauses in
AdaptiveSampler#sampled?
would always return false due to Integer division returning a result of zero. This method has been updated to use Float division instead, to exponentially back off the number of samples required. This may increase the number of traces collected for transactions. A huge thank you to @romul for bringing this to our attention and breaking down the problem!Bugfix: Correctly encode ASCII-8BIT log messages
The encoding update for the DecoratingLogger in v8.2.0 did not account for ASCII-8BIT encoded characters qualifying as
valid_encoding?
. Now, ASCII-8BIT characters will be encoded as UTF-8 and include replacement characters as needed. We're very grateful for @nikajukic's collaboration and submission of a test case to resolve this issue.
Support statement
New Relic recommends that you upgrade the agent regularly and at a minimum every 3 months. As of this release, the oldest supported version is 5.6.0.349.
v8.2.0
New instrumentation for Tilt gem
Template rendering using Tilt is now instrumented. Tilt 2.x is supported for Ruby versions 2.2 and above and 1.x is supported for Ruby versions below 2.7. See PR #847 for details.
Configuration
error_collector.ignore_errors
is marked as deprecatedThis setting has been marked as deprecated in the documentation since version 7.2.0 and is now flagged as deprecated within the code.
Remove Rails 2 instrumentation
Though any version of Rails 2 has not been supported by the Ruby agent since v3.18.1.330, instrumentation for ActionController and ActionWebService specific to that version were still part of the agent. This instrumentation has been removed.
Remove duplicated settings from newrelic.yml
Thank you @jakeonfire for bringing this to our attention and @kuroponzu for making the changes!
Bugfix: Span events recorded when using newrelic_ignore
Previously, the agent was incorrectly recording span events only on transactions that should be ignored. This fix will prevent any span events from being created for transactions using newrelic_ignore, or ignored through the
rules.ignore_url_regexes
configuration option.Bugfix: Print deprecation warning for cross-application tracing if enabled
Prior to this change, the deprecation warning would log whenever the agent started up, regardless of configuration. Thank you @alpha-san for bringing this to our attention!
Bugfix: Scrub non-unicode characters from DecoratingLogger
To prevent
JSON::GeneratorErrors
, the DecoratingLogger replaces non-Unicode characters with the replacement character: �. Thank you @jdelStrother for bringing this to our attention!Bugfix: Distributed tracing headers emitted errors when agent was not connected
Previously, when the agent had not yet connected it would fail to create a trace context payload and emit an error, "TypeError: no implicit conversion of nil into String," to the agent logs. The correct behavior in this situation is to not create these headers due to the lack of required information. Now, the agent will not attempt to create trace context payloads until it has connected. Thank you @Izzette for bringing this to our attention!
Support statement
New Relic recommends that you upgrade the agent regularly and at a minimum every 3 months. As of this release, the oldest supported version is 5.5.0.348.
v8.1.0
Instrumentation for Ruby standard library Logger
The agent will now automatically instrument Logger, recording number of lines and size of logging output, with breakdown by severity.
Bugfix for Padrino instrumentation
A bug was introduced to the way the agent installs padrino instrumentation in 7.0.0. This release fixes the issues with the padrino instrumentation. Thanks to @sriedel for bringing this issue to our attention.
Bugfix: Stop deadlocks between New Relic thread and Delayed Job sampling thread
Running the agent's polling queries for the DelayedJobSampler within the same ActiveRecord connection decreases the frequency of deadlocks in development environments. Thanks @jdelStrother for bringing this to our attention and providing excellent sample code to speed up development!
Bugfix: Allow Net::HTTP request to IPv6 addresses
The agent will no longer raise an
URI::InvalidURIError
error if an IPv6 address is passed to Net::HTTP. Thank you @tristinbarnett and @tabathadelane for crafting a solution!Bugfix: Allow integers to be passed to error_collector.ignore_status_codes configuration
Integers not wrapped in quotation marks can be passed to
error_collector.ignore_status_codes
in thenewrelic.yml
file. Our thanks goes to @elaguerta and @brammerl for resolving this issue!Bugfix: allow add_method_tracer to be used on BasicObjects
Previously, our
add_method_tracer
changes referencedself.class
which is not available onBasicObjects
. This has been fixed. Thanks to @toncid for bringing this issue to our attention.
Support statement
New Relic recommends that you upgrade the agent regularly and at a minimum every 3 months. As of this release, the oldest supported version is 5.4.0.347.
v8.0.0
add_method_tracer
refactored to use prepend over alias_method chainingThis release overhauls the implementation of
add_method_tracer
, as detailed in issue #502. The main breaking updates are as follows:A metric name passed to
add_method_tracer
will no longer be interpolated in an instance context as before. To maintain this behavior, pass a Proc object with the same arity as the method being traced. For example:# OLDadd_method_tracer :foo, '#{args[0]}.#{args[1]}'# NEWadd_method_tracer :foo, -> (*args) { "#{args[0]}.#{args[1]}" }Similarly, the
:code_header
and:code_footer
options toadd_method_tracer
will only accept a Proc object, which will be bound to the calling instance when the traced method is invoked.Calling
add_method_tracer
for a method will overwrite any previously defined tracers for that method. To specify multiple metric names for a single method tracer, pass them toadd_method_tracer
as an array.
See updated documentation on the following pages for full details:
Distributed tracing is enabled by default
Distributed tracing tracks and observes service requests as they flow through distributed systems. Distributed tracing is now enabled by default and replaces cross application tracing.
Bugfix: Incorrectly loading configuration options from newrelic.yml
The agent will now import the configuration options
error_collector.ignore_messages
anderror_collector.expected_messages
from thenewrelic.yml
file correctly.Cross Application is now deprecated, and disabled by default
Distributed tracing is replacing cross application tracing as the default means of tracing between services. To continue using it, enable it with
cross_application_tracer.enabled: true
anddistributed_tracing.enabled: false
Update configuration option default value for
span_events.max_samples_stored
from 1000 to 2000For more information about this congfiguration option, visit the Ruby agent documentation.
Agent now enforces server supplied maximum value for configuration option
span_events.max_samples_stored
Upon connection to the New Relic servers, the agent will now enforce a maximum value allowed for the configuration option
span_events.max_samples_stored
sent from the New Relic servers.Remove Ruby 2.0 required kwarg compatibility checks
Our agent has code that provides compatibility for required keyword arguments in Ruby versions below 2.1. Since the agent now only supports Ruby 2.2+, this code is no longer required.
Replace Time.now with Process.clock_gettime
Calls to
Time.now
have been replaced with calls toProcess.clock_gettime
to leverage the system's built-in clocks for elapsed time (Process::CLOCK_MONOTONIC
) and wall-clock time (Process::CLOCK_REALTIME
). This results in fewer object allocations, more accurate elapsed time records, and enhanced performance. Thanks to @sdemjanenko and @viraptor for advocating for this change!Updated generated default newrelic.yml
Thank you @wyhaines and @creaturenex for your contribution. The default newrelic.yml that the agent can generate is now updated with commented out examples of all configuration options.
Bugfix: Psych 4.0 causes errors when loading newrelic.yml
Psych 4.0 now uses safe load behavior when using
YAML.load
which by default doesn't allow aliases, causing errors when the agent loads the config file. We have updated how we load the config file to avoid these errors.Remove support for Excon versions below 0.19.0
Excon versions below 0.19.0 will no longer be instrumented through the Ruby agent.
Remove support for Mongo versions below 2.1
Mongo versions below 2.1 will no longer be instrumented through the Ruby agent.
Remove tests for Rails 3.0 and Rails 3.1
As of the 7.0 release, the Ruby agent stopped supporting Rails 3.0 and Rails 3.1. Despite this, we still had tests for these versions running on the agent's CI. Those tests are now removed.
Update test Gemfiles for patched versions
The gem has individual Gemfiles it uses to test against different common user setups. Rails 5.2, 6.0, and 6.1 have been updated to the latest patch versions in the test Gemfiles. Rack was updated in the Rails61 test suite to 2.1.4 to resolve a security vulnerability.
Remove Merb Support
This release removes the remaining support for the Merb framework. It merged with Rails during the 3.0 release. Now that the Ruby agent supports Rails 3.2 and above, we thought it was time to say goodbye.
Remove deprecated method External.start_segment
The method
NewRelic::Agent::External.start_segment
has been deprecated as of Ruby Agent 6.0.0. This method is now removed.Added testing and support for the following gem versions
- activemerchant 1.121.0
- bunny 2.19.0
- excon 0.85.0
- mongo 2.14.0, 2.15.1
- padrino 0.15.1
- resque 2.1.0
- sequel 5.48.0
- yajl-ruby 1.4.1
This version adds support for ARM64/Graviton2 platform using Ruby 3.0.2+
Support statement
New Relic recommends that you upgrade the agent regularly and at a minimum every 3 months. As of this release, the oldest supported version is 5.4.0.347.
v7.2.0
Expected Errors and Ignore Errors This release adds support for configuration of expected/ignored errors by class name, status code, and message. The following configuration options are now available:
error_collector.ignore_classes
error_collector.ignore_messages
error_collector.ignore_status_codes
error_collector.expected_classes
error_collector.expected_messages
error_collector.expected_status_codes
For more details about expected and ignored errors, please see our configuration documentation
Bugfix: resolves "can't add a new key into hash during iteration" Errors
Thanks to @wyhaines for this fix that prevents "can't add a new key into hash during iteration" errors from occuring when iterating over environment data.
Bugfix: kwarg support fixed for Rack middleware instrumentation
Thanks to @walro for submitting this fix. This fixes the rack instrumentation when using kwargs.
Update known conflicts with use of Module#Prepend
With our release of v7.0.0, we updated our instrumentation to use Module#Prepend by default, instead of method chaining. We have received reports of conflicts and added a check for these known conflicts. If a known conflict with prepend is detected while using the default value of 'auto' for gem instrumentation, the agent will instead install method chaining instrumentation in order to avoid this conflict. This check can be bypassed by setting the instrumentation method for the gem to 'prepend'.
Support statement
New Relic recommends that you upgrade the agent regularly and at a minimum every 3 months. As of this release, the oldest supported version is 5.2.0.345.
v7.1.0
Add support for CSP nonces when using our API to insert the Browser agent
We now support passing in a nonce to our API method
browser_timing_header
to allow the Browser agent to run on applications using CSP nonces. This allows users to inject the Browser agent themselves and use the nonce required for the script to run. In order to utilize this new feature, you must disable auto instrumentation for the Browser agent, and use the API methodbrowser_timing_header
to pass the nonce in and inject the script manually.Removed MD5 use in the SQL sampler
In order to allow the agent to run in FIPS compliant environments, the usage of MD5 for aggregating slow sql traces has been replaced with SHA1.
Enable server-side configuration of distributed tracing
distributed_tracing.enabled
may now be set in server-side application configuration.Bugfix: Fix for missing part of a previous bugfix
Our previous fix of "nil Middlewares injection now prevented and gracefully handled in Sinatra" released in 7.0.0 was partially overwritten by some of the other changes in that release. This release adds back those missing sections of the bugfix, and should resolve the issue for Sinatra users.
Update known conflicts with use of Module#Prepend
With our release of v7.0.0, we updated our instrumentation to use
Module#Prepend
by default, instead of method chaining. We have received reports of conflicts and added a check for these known conflicts. If a known conflict with prepend is detected while using the default value of 'auto' for gem instrumentation, the agent will instead install method chaining instrumentation in order to avoid this conflict. This check can be bypassed by setting the instrumentation method for the gem to 'prepend'.Bugfix: Updated support for ActiveRecord 6.1+ instrumentation
Previously, the agent depended on
connection_id
to be present in the Active Support instrumentation forsql.active_record
to get the current ActiveRecord connection. As of Rails 6.1,connection_id
has been dropped in favor of providing the connection object through theconnection
value exclusively. This resulted in datastore spans displaying fallback behavior, including showing "ActiveRecord" as the database vendor.Bugfix: Updated support for Resque's FORK_PER_JOB option
Support for Resque's FORK_PER_JOB flag within the Ruby agent was incomplete and nonfunctional. The agent should now behave correctly when running in a non-forking Resque worker process.
Bugfix: Added check for ruby2_keywords in add_transaction_tracer
Thanks @beauraF for the contribution! Previously, the add_transaction_tracer was not updated when we added support for ruby 3. In order to correctly support
**kwargs
,ruby2_keywords
was added to correctly update the method signature to use**kwargs
in ruby versions that support that.Confirmed support for yajl 1.4.0
Thanks to @creaturenex for the contribution!
yajl-ruby
1.4.0 was added to our test suite and confirmed all tests pass, showing the agent supports this version as well.
Support statement
New Relic recommends that you upgrade the agent regularly and at a minimum every 3 months. As of this release, the oldest supported version is 5.2.0.345.