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.
v7.0.0
Ruby Agent 6.x to 7.x Migration Guide Available
Please see our Ruby Agent 6.x to 7.x migration guide for helpful strategies and tips for migrating from earlier versions of the Ruby agent to 7.0.0. We cover new configuration settings, diagnosiing and installing SSL CA certificates and deprecated items and their replacements in this guide.
Ruby 2.0 and 2.1 dropped
Support for Ruby 2.0 and 2.1 dropped with this release. We do not know of code changes that would prevent the agent from continuing to work with these releases. However, Rubies 2.0 and 2.1 are no longer included in our test matrices and are not supported for 7.0.0 and onward.
Implemented prepend auto-instrumentation strategies for most Ruby gems/libraries
This release brings the auto-instrumentation strategies for most gems into the modern era for Ruby by providing both prepend and method-chaining (also known as method-aliasing) strategies for auto instrumenting. Prepend, which has been available since Ruby 2.0, is now the default strategy employed in auto-instrumenting. It's a known issue that some external gems lead to Stack Level too Deep exceptions when prepend and method-chaining are mixed. In such known cases, the auto-instrumenting strategy will fall back to method-chaining automatically.
This release also deprecates many overlapping and inconsistently named configuration settings in favor of being able to control behavior of instrumentation per library with one setting that can be one of auto (the default), disabled, prepend, or chain.
Please see the above-referenced migration guide for further details.
Removed SSL cert bundle
The agent will no longer ship this bundle and will rely on system certs.
Removed deprecated config options
The following config options were previously deprecated and are no longer available:
disable_active_record_4
disable_active_record_5
autostart.blacklisted_constants
autostart.blacklisted_executables
autostart.blacklisted_rake_tasks
strip_exception_messages.whitelist
Removed deprecated attribute
The attribute
httpResponseCode
was previously deprecated and replaced withhttp.statusCode
. This deprecated attribute has now been removed.Removed deprecated option in notice_error
Previously, the
:trace_only
option toNewRelic::Agent.notice_error
was deprecated and replaced with:expected
. This deprecated option has been removed.Removed deprecated API methods
Previously the API methods
create_distributed_trace_payload
andaccept_distributed_trace_payload
were deprecated. These have now been removed. Instead, please seeinsert_distributed_trace_headers
andaccept_distributed_trace_headers
, respectively.Bugfix: Prevent browser monitoring middleware from installing to middleware multiple times
In rare cases on jRuby, the BrowserMonitoring middleware could attempt to install itself multiple times at start up. This bug fix addresses that by using a mutex to introduce thread safety to the operation. Sinatra in particular can have this race condition because its middleware stack is not installed until the first request is received.
Skip constructing Time for transactions
Thanks to @viraptor, we are no longer constructing an unused Time object with every call to starting a new Transaction.
Bugfix: nil Middlewares injection now prevented and gracefully handled in Sinatra
Previously, the agent could potentially inject multiples of an instrumented middleware if Sinatra received many requests at once during start up and initialization due to Sinatra's ability to delay full startup as long as possible. This has now been fixed, and the Ruby agent correctly instruments only once as well as gracefully handles nil middleware classes in general.
Bugfix: Ensure transaction nesting max depth is always consistent with length of segments
Thanks to @warp for noticing and fixing the scenario where Transaction
nesting_max_depth
can get out of sync with segment length resulting in an exception when attempting to nest the initial segment which does not exist.
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 4.8.0.
v6.15.0
Official Ruby 3.0 support
The Ruby agent has been verified to run on Ruby 3.0.0.
Added support for Rails 6.1
The Ruby agent has been verified to run with Rails 6.1. Special thanks to @hasghari for setting this up!
Added support for Sidekiq 6.0, 6.1
The Ruby agent has been verified to run with both 6.0 and 6.1 versions of sidekiq.
Bugfix: No longer overwrites sidekiq trace data
Distributed tracing data is now added to the job trace info rather than overwriting the existing data.
Bugfix: Fixes cases where errors are reported for spans with no other attributes
Previously, in cases where a span does not have any agent/custom attributes on it, but an error is noticed and recorded against the span, a
FrozenError: can't modify frozen Hash
is thrown. This is now fixed, and errors are now correctly recorded against such span events.Bugfix:
DistributedTracing.insert_distributed_trace_headers
Supportability metric now recordedPreviously, API calls to
DistributedTracing.insert_distributed_trace_headers
would lead to an exception about the missing supportability metric rather than flowing through the API implementation as intended. This would potentially lead to broken distributed traces, as the trace headers were not inserted on the API call.DistributedTracing.insert_distributed_trace_headers
now correctly records the supportability metric and inserts the distributed trace headers as intended.Bugfix: child completions after parent completes sometimes throws exception attempting to access nil parent
In scenarios where the child segment/span is completing after the parent in jRuby, the parent may have already been freed and no longer accessible. This would lead to attempting to calll
descendant_complete
on a nil object. This is fixed to protect against calling thedescendant_complete
in these cases.Feature: implements
force_install_exit_handler
config flagThe
force_install_exit_handler
configuration flag allows an application to instruct the agent to install its graceful shutdown exit handler. This sends any locally cached data to the New Relic collector before the application shuts down. This is useful when the primary framework has an embedded Sinatra application that is otherwise detected and skips installing the exit hook for graceful shutdowns.Default prepend_net_instrumentation to false
Previously,
prepend_net_instrumentation
defaulted totrue
. However, many gems are still using monkey patching on Net::HTTP, which causes compatibility issues with using prepend. Defaulting this tofalse
minimizes instances of unexpected compatibility issues.Infinite tracing adds additional data to connection metadata
Adds data from the agents connect response
request_headers_map
to the metadata for the connection to the infinite trace observer.
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 4.8.0.
v6.14.0
Bugfix: Method tracers no longer cloning arguments
Previously, when calling add_method_tracer with certain combination of arguments, it would lead to the wrapped method's arguments being cloned rather than passed to the original method for manipulation as intended. This has been fixed.
Bugfix: Delayed Job instrumentation fixed for Ruby 2.7+
Previously, the agent was erroneousy separating positional and keyword arguments on the instrumented method calls into Delayed Job's library. The led to Delayed job not auto-instrumenting correctly and has been fixed.
Bugfix: Ruby 2.7+ methods sometimes erroneously attributed compiler warnings to the Agent's
add_method_tracer
The specific edge cases presented are now fixed by this release of the agent. There are still some known corner-cases that will be resolved with upcoming changes in next major release of the Agent. If you encounter a problem with adding method tracers and compiler warnings raised, please continue to submit small repoducible examples.
Bugfix: Ruby 2.7+ fix for keyword arguments on Rack apps is unnecessary and removed
A common fix for positional and keyword arguments for method parameters was implemented where it was not needed and led to RackApps getting extra arguments converted to keyword arguments rather than Hash when it expected one. This Ruby 2.7+ change was reverted so that Rack apps behave correctly for Ruby >= 2.7.
Feature: captures incoming and outgoing request headers for distributed tracing
HTTP request headers will be logged when log level is at least debug level. Similarly, request headers for exchanges with New Relic servers are now audit logged when audit logging is enabled.
Bugfix:
newrelic.yml.erb
added to the configuration search pathPreviously, when a user specifies a
newrelic.yml.erb
and nonewrelic.yml
file, the agent fails to find the.erb
file because it was not in the list of files searched at startup. The Ruby agent has long supported this as a means of configuring the agent programatically. Thenewrelic.yml.erb
filename is restored to the search path and will be utilized if present. NOTE:newrelic.yml
still takes precedence overnewrelic.yml.erb
If found, the.yml
file is used instead of the.erb
file. Search directories and order of traversal remain unchanged.Bugfix: dependency detection of Redis now works without raising an exception
Previously, when detecting if Redis was available to instrument, the dependency detection would fail with an Exception raised (with side effect of not attempting to instrument Redis). This is now fixed with a better dependency check that resolves falsly without raising an
Exception
.Bugfix: Gracefully handles NilClass as a Middleware Class when instrumenting
Previously, if a NilClass is passed as the Middleware Class to instrument when processing the middleware stack, the agent would fail to fully load and instrument the middleware stack. This fix gracefully skips over nil classes.
Memory Sampler updated to recognize macOS Big Sur
Previously, the agent was unable to recognize the platform macOS Big Sur in the memory sampler, resulting in an error being logged. The memory sampler is now able to recognize Big Sur.
Prepend implementation of Net::HTTP instrumentation available
There is now a config option (
prepend_net_instrumentation
) that will enable the agent to use prepend while instrumenting Net::HTTP. This option is set to true by default.
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 4.5.0.
v6.13.1
Bugfix: obfuscating URLs to external services no longer modifying original URI
A recent change to the Ruby agent to obfuscate URIs sent to external services had the unintended side-effect of removing query parameters from the original URI. This is fixed to obfuscate while also preserving the original URI.
Thanks to @VictorJimenezKwast for pinpointing and helpful unit test to demonstrate.