重要
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.8.0
Version 9.8.0 introduces instrumentation for ruby-openai, adds the option to store tracer state on the thread-level, hardens the browser agent insertion logic to better proactively anticipate errors, and prevents excpetions from being raised in the Active Support Broadcast logger instrumentation.
Feature: Add instrumentation for ruby-openai
Instrumentation has been added for the ruby-openai gem, supporting versions 3.4.0 and higher (PR#2442). While ruby-openai instrumentation is enabled by default, the configuration option
ai_monitoring.enabled
is disabled by default and controls all AI monitoring.ai_monitoring.enabled
must be set totrue
in order to receive ruby-openai instrumentation. High-Security Mode must be disabled in order to receive AI monitoring.Calls to embedding and chat completion endpoints are automatically traced. These events can be enhanced with the introduction of two new APIs. Custom attributes can also be added to LLM events using the API
NewRelic::Agent.add_custom_attributes
, but they must be prefixed withllm.
. For example,NewRelic::Agent.add_custom_attributes({'llm.user_id': user_id})
.Feature: Add AI monitoring APIs
This version introduces two new APIs that allow users to record additional information on LLM events:
NewRelic::Agent.record_llm_feedback_event
- Records user feedback events.NewRelic::Agent.set_llm_token_count_callback
- Sets a callback proc for calculatingtoken_count
attributes for embedding and chat completion message events.
Visit RubyDoc for more information on each of these APIs.
Feature: Store tracer state on thread-level
A new configuration option,
thread_local_tracer_state
, stores New Relic's tracer state on the thread-level, as opposed to the default fiber-level storage. This configuration is turned off by default. Our thanks go to community member @markiz who contributed the idea, code, configuration option, and tests for this new feature! PR#2475.Bugfix: Harden the browser agent insertion logic
With Issue#2462, community member @miry explained that it was possible for an HTTP response headers hash to have symbols for values. Not only would these symbols prevent the inclusion of the New Relic browser agent tag in the response body, but more importantly they would cause an exception that would bubble up to the monitored web application itself. With PR#2465 symbol based values are now supported and all other potential future exceptions are now handled. Additionally, the refactor to support symbols has been shown through benchmarking to give the processing of string and mixed type hashes a slight speed boost too.
Bugfix: Prevent Exception in Active Support Broadcast logger instrumentation
Previously, in certain situations the agent could cause an exception to be raised when attempting to interact with a broadcast log event. This has been fixed. Thanks to @nathan-appere for reporting this issue and providing a fix! PR#2510
重要
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.7.1
Version 9.7.1 fixes a ViewComponent instrumentation bug and enforces maximum size limits for custom event attributes.
Bugfix: Stop suppressing ViewComponent errors
Previously, the agent suppressed ViewComponent render errors. The agent now reports these errors and allows them to raise. Thank you @mjacobus for reporting this bug and providing a fix! PR#2410
Bugfix: Enforce maximum size limits for custom event attributes
Previously, the agent would allow custom event attributes to be any size. This would lead to the New Relic backend dropping attributes larger than the maximum size. Now, the agent will truncate custom event attribute values to 4095 characters, attribute names to 255 characters, and the total count of attributes to 64. PR#2401
重要
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.7.0
Version 9.7.0 introduces ViewComponent instrumentation, changes the endpoint used to access the cluster name for Elasticsearch instrumentation, removes the creation of the Ruby/Thread and Ruby/Fiber spans, and adds support for Falcon.
Feature: ViewComponent instrumentation
ViewComponent is a now an instrumented library. PR#2367
Feature: Use root path to access Elasticsearch cluster name
Previously, the agent used the cluster health endpoint (
/_cluster/health
) to access the cluster name. However, this has been found to make startup unstable for large clusters. Now, the agent uses the more performant root endpoint (/
).Our thanks go to @erikkessler1, @gremerritt, and @joshbranham for reporting the issue, suggesting solutions, and testing them. Issue#2360 PR#2377
Feature: Remove base64 dependency, use direct calls to String methods
In version 9.6.0, the agent required the Ruby
base64
gem as a depdendency to prepare for deprecation warnings in Ruby 3.3 and the gem's removal from the Ruby standard libraries in 3.4. Includingbase64
as a dependency has caused problems with version resolution in some environments.To resolve this, the agent now directly calls the
String
methods used in thebase64
library in the newNewRelic::Base64
module.Thank you, @Earlopain, for submitting this change. PR#2378
Feature: Add Falcon support
Feature: Remove spans with name Ruby/Thread and Ruby/Fiber
Due to the lack of helpful information and the confusion commonly caused by the spans named Ruby/Thread and Ruby/Fiber, these spans have been removed. However, the agents ability to monitor instrumented code running in a thread or fiber will remain unchanged. PR#2389
重要
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.6.0
Version 9.6.0 adds instrumentation for Async::HTTP, Ethon, and HTTPX, adds the ability to ignore specific routes with Roda, gleans Docker container IDs from cgroups v2-based containers, records additional synthetics attributes, fixes an issue with Rails 7.1 that could cause duplicate log records to be sent to New Relic, fixes a deprecation warning for the Sidekiq error handler, adds additional attributes for OpenTelemetry compatibility, and resolves some technical debt, thanks to the community.
Feature: Add instrumentation for Async::HTTP
The agent will now record spans for Async::HTTP requests. Versions 0.59.0 and above of the async-http gem are supported. PR#2272
Feature: Add instrumentation for Ethon
Instrumentation has been added for the Ethon HTTP client gem. Versions 0.12.0 and above are supported. The agent will now record external request segments for invocations of
Ethon::Easy#perform
andEthon::Multi#perform
. NOTE: The Typhoeus gem is maintained by the same team that maintains Ethon and depends on Ethon for its functionality. To prevent duplicate reporting for each HTTP request, the Ethon instrumentation will be disabled when Typhoeus is detected. PR#2260Feature: Add instrumentation for HTTPX
The agent now offers instrumentation for the HTTP client HTTPX, provided the gem is at version 1.0.0 or above. PR#2278
Feature: Prevent the agent from starting in "rails" commands in Rails 7
Previously, the agent ignored many Rails commands by default, such as
rails routes
, using Rake-specific logic. This was accomplished by setting these commands as default values for the config optionautostart.denylisted_rake_tasks
. However, Rails 7 no longer uses Rake for these commands, causing the agent to start running and attempting to record data when running these commands. The commands have now been added to the default value for the config optionautostart.denylisted_constants
, which will allow the agent to recognize these commands correctly in Rails 7 and prevent the agent from starting during ignored tasks. Note that the agent will continue to start-up when therails server
andrails runner
commands are invoked. PR#2239Feature: Glean Docker container ID for cgroups v2-based containers
Previously, the agent was only capable of determining a host Docker container's ID if the container was based on cgroups v1. Now, containers based on cgroups v2 will also have their container IDs reported to New Relic. PR#2229.
Feature: Update events with additional synthetics attributes when available
The agent will now record additional synthetics attributes on synthetics events if these attributes are available. PR#2203
Feature: Declare a gem dependency on the Ruby Base 64 gem 'base64'
For compatibility with Ruby 3.4 and to silence compatibility warnings present in Ruby 3.3, declare a dependency on the
base64
gem. The New Relic Ruby agent uses the native Rubybase64
gem for Base 64 encoding/decoding. The agent is joined by Ruby on Rails (rails/rails@3e52adf) and others in making this change in preparation for Ruby 3.3/3.4. PR#2238Feature: Add Roda support for the newrelic_ignore* family of methods
The agent can now selectively disable instrumentation for particular requests within Roda applications. Supported methods include:
newrelic_ignore
: ignore a given route.newrelic_ignore_apdex
: exclude a given route from consideration in overall Apdex calculations.newrelic_ignore_enduser
: prevent automatic injection of the page load timing JavaScript when a route is rendered.
For more information, see Roda Instrumentation. PR#2267
Feature: Add additional span attributes for OpenTelemetry compatibility
For improved compatibility with OpenTelemetry's semantic conventions, the agent's datastore (for databases) and external request (for HTTP clients) segments have been updated with additional attributes.
Datastore segments now offer 3 additional attributes:
db.system
: The database system. For Ruby we use the database adapter name here.server.address
: The database host.server.port
: The database port.
External request segments now offer 3 additional attributes:
http.request.method
: The HTTP method (ex: 'GET')server.address
: The target host.server.port
: The target port.
For maximum backwards compatibility, no existing attributes have been renamed or removed. PR#2283
Bugfix: Stop sending duplicate log events for Rails 7.1 users
Rails 7.1 introduced the public API
ActiveSupport::BroadcastLogger
. This logger replaces a private API,ActiveSupport::Logger.broadcast
. In Rails versions below 7.1, the agent uses thebroadcast
method to stop duplicate logs from being recoded by broadcasted loggers. Now, we've updated the code to provide a similar duplication fix for theActiveSupport::BroadcastLogger
class. PR#2252Bugfix: Resolve Sidekiq 8.0 error handler deprecation warning
Sidekiq 8.0 will require procs passed to the error handler to include three arguments: error, context, and config. Users running sidekiq/main would receive a deprecation warning with this change any time an error was raised within a job. Thank you, @fukayatsu for your proactive fix! PR#2261
Community: Resolve technical debt
We also received some great contributions from community members to resolve some outstanding technical debt issues. Thank you for your contributions!
- Add and Replace SLASH and ROOT constants: PR#2256 chahmedejaz
- Remove pry as a dev dependency: PR#2665, PR#2273 AlajeBash
- Replace "start up" with "start-up": PR#2249 chahmedejaz
- Remove unused variables in test suites: PR#2250
重要
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.5.0
Version 9.5.0 introduces Stripe instrumentation, allows the agent to record additional response information on a transaction when middleware instrumentation is disabled, introduces new :'sidekiq.args.include'
and :'sidekiq.args.exclude:
configuration options to permit capturing only certain Sidekiq job arguments, updates Elasticsearch datastore instance metrics, and fixes a bug in NewRelic::Rack::AgentHooks.needed?
.
Feature: Add Stripe instrumentation
Stripe calls are now automatically instrumented. Additionally, new
:'stripe.user_data.include'
and:'stripe.user_data.exclude'
configuration options permit capturing customuser_data
key-value pairs that can be stored in Stripe events. Nouser_data
key-value pairs are captured by default. The agent currently supports Stripe versions 5.38.0+. PR#2180Feature: Report transaction HTTP status codes when middleware instrumentation is disabled
Previously, when
disable_middleware_instrumentation
was set totrue
, the agent would not record the value of the response code or content type on the transaction. This was due to the possibility that a middleware could alter the response, which would not be captured by the agent when the middleware instrumentation was disabled. However, based on customer feedback, the agent will now report the HTTP status code and content type on a transaction when middleware instrumentation is disabled. PR#2175Feature: Permit capturing only certain Sidekiq job arguments
New
:'sidekiq.args.include'
and:'sidekiq.args.exclude'
configuration options have been introduced to permit fine grained control over which Sidekiq job arguments (args) are reported to New Relic. By default, no Sidekiq args are reported. To report any Sidekiq options, the:'attributes.include'
array must include the string'jobs.sidekiq.args.*'
. With that string in place, all arguments will be reported unless one or more of the new include/exclude options are used. The:'sidekiq.args.include'
option can be set to an array of strings. Each of those strings will be passed toRegexp.new
and collectively serve as an allowlist for desired args. For job arguments that are hashes, if a hash's key matches one of the include patterns, then both the key and its corresponding value will be included. For scalar arguments, the string representation of the scalar will need to match one of the include patterns to be captured. The:'sidekiq.args.exclude'
option works similarly. It can be set to an array of strings that will each be passed toRegexp.new
to create patterns. These patterns will collectively serve as a denylist for unwanted job args. Any hash key, hash value, or scalar that matches an exclude pattern will be excluded (not sent to New Relic). PR#2177newrelic.yml
examples:Any string in the
:'sidekiq.args.include'
or:'sidekiq.args.exclude'
arrays will be turned into a regular expression. Knowledge of Ruby regular expression support can be leveraged but is not required. If regular expression syntax is not used, inexact matches will be performed and the string "Fortune" will match both "Fortune 500" and "Fortune and Glory". For exact matches, use regular expression anchors.# Include any argument whose string representation matches either "apple" or "banana"# The "apple" pattern will match both "green apple" and "red apple"sidekiq.args.include:- apple- banana# Exclude any arguments that match either "grape", "orange", or "pear"sidekiq.args.exclude:- grape- orange- pear# Exclude any argument that is a 9 digit numbersidekiq.args.exclude:- '\d{9}'# Include anything that starts with "blue" but exclude anything that ends in "green"sidekiq.args.include- '^blue'sidekiq.args.exclude- 'green$'Bugfix: Update Elasticsearch datastore instance metric to use port instead of path
Previously, the Elasticsearch datastore instance metric (
Datastore/instance/Elasticsearch/<host>/*
) used the path as the final value. This caused a metrics grouping issue for some users, as every document ID created a unique metric. Now, the datastore instance metric has been updated to use the port as the final value. This also has the benefit of being more accurate for datastore instance metrics, as this port is directly associated with the already listed host.Bugfix: Resolve inverted logic of NewRelic::Rack::AgentHooks.needed?
Previously,
NewRelic::Rack::AgentHooks.needed?
incorrectly used inverted logic. This has now been resolved, allowing AgentHooks to be installed whendisable_middleware_instrumentation
is set to true. PR#2175
重要
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.4.2
Version 9.4.2 of the agent re-addresses the 9.4.0 issue of NoMethodError
seen when using the uppy-s3_multipart
gem.
Bugfix: Resolve NoMethodError
Ruby agent 9.4.1 attempted to fix a
NoMethodError
introduced in 9.4.0. A missingrequire
prevented a method from scoping appropriately and has now been added. Thanks to @spickermann and @ColinOrr for working with us to get this resolved. PR#2167
重要
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.4.1
Version 9.4.1 of the agent resolves a NoMethodError
introduced in 9.4.0.
Bugfix: Resolve NoMethodError
Ruby agent 9.4.0 introduced Roda instrumentation, which caused a
NoMethodError
to be raised when attempting to name a Roda transaction. This has been fixed. Thanks to @spickermann for reporting this issue. PR#2167
重要
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.4.0
Version 9.4.0 of the agent adds Roda instrumentation, adds a new allow_all_headers
configuration option to permit capturing all HTTP headers, introduces improved error tracking functionality by associating a transaction id with each error, and uses more reliable network timeout logic.
Feature: Add Roda instrumentation
Roda is a now an instrumented framework. The agent currently supports Roda versions 3.19.0+. PR#2144
Feature: New allow_all_headers configuration option
A new
allow_all_headers
configuration option brings parity with the Node.js agent to capture all HTTP request headers.This configuration option:
- Defaults to
false
- Is not compatible with high-security mode
- Requires Rack version 2 or higher (as does Ruby on Rails version 5 and above)
- Respects all existing behavior for the
attributes.include
andattributes.exclude
configuration options - Captures the additional headers as attributes prefixed with
request.headers.
This work was done in response to a feature request submitted by community member @jamesarosen. Thank you very much, @jamesarosen! Issue#1029
- Defaults to
Feature: Improved error tracking transaction linking
Errors tracked and sent to the New Relic errors inbox will now be associated with a transaction id to enable improved UI/UX associations between transactions and errors. PR#2035
Feature: Use Net::HTTP native timeout logic
In line with current Ruby best practices, make use of Net::HTTP's own timeout logic and avoid the use of
Timeout.timeout()
when possible. The agent's data transmissions and cloud provider detection routines have been updated accordingly. PR#2147
重要
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.1
Version 9.3.1 of the agent fixes NewRelic::Agent.require_test_helper
.
Bugfix: Fix NewRelic::Agent.require_test_helper
Version 9.3.0 of the agent made a change to the files distributed with the gem. This change unintentionally broke the
NewRelic::Agent.require_test_helper
API by removing thetest/agent_helper.rb
file. The file has been added back to the gem. This change also removes thelib/new_relic/build.rb
file from the list because it is no longer created with our current release process.Our thanks go to @ajesler for reporting this issue and writing a test for the bug. Issue#2113, PR#2115, Issue#2117, PR#2118
Source Documentation: update the Rack spec URL
Community member @olleolleolle noticed that our source code was referencing a now defunct URL for the Rack specification and submitted PR#2121 to update it. He also provided a terrific recommendation that we automate the checking of links to proactively catch defunct ones in future. Thanks, @olleolleolle!
重要
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