v8.11.0
Version 8.11.0 of the agent updates the newrelic deployments command to work with API keys issued to newer accounts, fixes a memory leak in the instrumentation of Curb error handling, further preps for Ruby 3.2.0 support, and includes several community member driven cleanup and improvement efforts. Thank you to everyone involved!
Added support for New Relic REST API v2 when using
newrelic deploymentscommandPreviously, the
newrelic deploymentscommand only supported the older version of the deployments api, which does not currently support newer license keys. Now you can use the New Relic REST API v2 to record deployments by providing your user API key to the agent configuration usingapi_key. When this configuration option is present, thenewrelic deploymentscommand will automatically use the New Relic REST API v2 deployment endpoint. PR#1461Thank you to @Arkham for bringing this to our attention!
Cleanup: Performance tests, constants, rubocop-minitest assertions and refutations
Community member @esquith contributed a whole slew of cleanup successes for our performance test configuration, orphaned constants in our code base, and RuboCop related improvements. PR#1406 PR#1408 PR#1409 PR#1411
Thank you @esquith for these great contributions!
CI: Notify on a change from failure to success
A super handy, much beloved feature of certain CI and build systems is to not only notify when builds start to fail, but also to notify again when the builds once again start to go green. Community member @luigieai was able to figure out how to configure our existing complex, multiple-3rd-party-action based GitHub Actions pipeline to notify on a switch back to success from failure. PR#1519
This is much appreciated! Thank you, @luigieai.
Spelling corrections
Community member @jsoref, author of the Check Spelling GitHub Action, contributed a significant number of spelling corrections throughout the code base. The intelligent issues that were flagged made for a more comprehensive review than a simple dictionary based check would have been able to provide, and the changes are much appreciated. PR#1508
Thank you very much, @jsoref!
Ruby 3.2.0-preview2 compatibility
Ruby 3.2.0-preview1 introduced a change to the way that Ruby reports VM stats and the approach was changed yet again to a 3rd approach with the preview2 release. New Relic reports on Ruby VM stats and is keeping track of the Ruby 3.2 development process to help ensure our customers with a smooth and worthwhile upgrade process once Ruby 3.2.0 (non-preview) is released. PR#1436
Bugfix: Fix memory leak in the Curb instrumentation
Community member @charkost was able to rework the
on_failurecallback logic prepped via the agent's Curb instrumentation in order to avoid some nesting that was causing memory leaks. PR#1518Many thanks for both the heads up on the issue and the fix, @charkost!
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.7.0.359.
v8.10.1
Bugfix: Missing unscoped metrics when instrumentation.thread.tracing is enabled
Previously, when
instrumentation.thread.tracingwas set to true, some puma applications encountered a bug where a varying number of unscoped metrics would be missing. The agent now will correctly store and send all unscoped metrics.Thank you to @texpert for providing details of their situation to help resolve the issue.
Bugfix: gRPC instrumentation causes ArgumentError when other Google gems are present
Previously, when the agent had gRPC instrumentation enabled in an application using other gems (such as google-ads-googleads), the instrumentation could cause the error
ArgumentError: wrong number of arguments (given 3, expected 2). The gRPC instrumentation has been updated to prevent this issue from occurring in the future.Thank you to @FeminismIsAwesome 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 6.5.0.357.
v8.10.0
New gRPC instrumentation
The agent will now instrument gRPC activity performed by clients and servers that use the grpc RubyGem. Instrumentation is automatic and enabled by default, so gRPC users should not need to modify any existing application code or agent configuration to benefit from the instrumentation. The instrumentation makes use of distributed tracing for a comprehensive overview of all gRPC traffic taking place across multiple monitored applications. This allows you to observe your client and server activity using any service that adheres to the W3C standard.
The following new configuration parameters have been added for gRPC. All are optional.
Configuration name Default Behavior instrumentation.grpc_clientauto Set to 'disabled' to disable, set to 'chain' if there are module prepending conflicts instrumentation.grpc_serverauto Set to 'disabled' to disable, set to 'chain' if there are module prepending conflicts instrumentation.grpc.host_denylist"" Provide a comma delimited list of host regex patterns (ex: "private.com$,exception.*") Code-level metrics functionality is enabled by default
The code-level metrics functionality for the Ruby agent's CodeStream integration is now enabled by default after we have received positive feedback and no open bugs for the past two releases.
Performance: Rework timing range overlap calculations for multiple transaction segments
Many thanks to GitHub community members @bmulholland and @hkdnet. @bmulholland alerted us to rmosolgo/graphql-ruby#3945. That Issue essentially notes that the New Relic Ruby agent incurs a significant perfomance hit when the
graphqlRubyGem (which ships with New Relic Ruby agent support) is used with DataLoader to generate a high number of transactions. Then @hkdnet diagnosed the root cause in the Ruby agent and put together both a proof of concept fix and a full blown PR to resolve the problem. The agent keeps track multiple segments that are concurrently in play for a given transaction in order to merge the ones whose start and stop times intersect. The logic for doing this find-and-merge operation has been reworked to a) be deferred entirely until the transaction is ready to be recorded, and b) made more performant when it is needed. GraphQL DataLoader users and other users who generate lots of activity for monitoring within a short amount of time will hopefully see some good performance gains from these changes.
Performance: Make frozen string literals the default for the agent
The Ruby
frozen_string_literal: truemagic source code comment has now been applied consistently across all Ruby files belonging to the agent. This can provide a performance boost, given that Ruby can rely on the strings remaining immutable. Previously only about a third of the agent's code was freezing string literals by default. Now that 100% of the code freezes string literals by default, we have internally observed some related performance gains through testing. We are hopeful that these will translate into some real world gains in production capacities.
Bugfix: Error when setting the yaml configuration with
transaction_tracer.transaction_threshold: apdex_fOriginally, the agent was only checking the
transaction_tracer.transaction_thresholdfrom the newrelic.yml correctly if it was on two lines.Example:
# newrelic.ymltransaction_tracer:transaction_threshold: apdex_fWhen this was instead changed to be on one line, the agent was not able to correctly identify the value of apdex_f.
Example:
# newrelic.ymltransaction_tracer.transaction_threshold: apdex_fThis would cause prevent transactions from finishing due to the error
ArgumentError: comparison of Float with String failed. This has now been corrected and the agent is able to process newrelic.yml with a one linetransaction_tracer.transaction_threshold: apdex_fcorrectly now.Thank you to @oboxodo for bringing this to our attention.
Bugfix: Don't modify frozen Logger
Previously the agent would modify each instance of the Logger class by adding a unique instance variable as part of the instrumentation. This could cause the error
FrozenError: can't modify frozen Loggerto be thrown if the Logger instance had been frozen. The agent will now check if the object is frozen before attempting to modify the object. Thanks to @mkcosta 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 6.5.0.357.
v8.9.0
Add support for Dalli 3.1.0 to Dalli 3.2.2
Dalli versions 3.1.0 and above include breaking changes where the agent previously hooked into the gem. We have updated our instrumentation to correctly hook into Dalli 3.1.0 and above. At this time, 3.2.2 is the latest Dalli version and is confirmed to be supported.
Bugfix: Infinite Tracing hung on connection restart
Previously, when using infinite tracing, the agent would intermittently encounter a deadlock when attempting to restart the infinite tracing connection. This bug would prevent the agent from sending all data types, including non-infinite-tracing-related data. This change reworks how we restart Infinite Tracing to prevent potential deadlocks.
Bugfix: Use read_nonblock instead of read on pipe
Previously, our PipeChannelManager was using read which could cause resque jobs to get stuck in some versions. This change updates the PipeChannelManager to use read_nonblock instead to avoid 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 6.5.0.357.
v8.8.0
Support Makara database adapters with ActiveRecord
Thanks to a community submission from lucasklaassen with PR #1177, the Ruby agent will now correctly work well with the Makara gem. Functionality such as SQL obfuscation should now work when Makara database adapters are used with Active Record.
Lowered the minimum payload size to compress
Previously the Ruby agent used a particularly large payload size threshold of 64KiB that would need to be met before the agent would compress data en route to New Relic's collector. The original value stems from segfault issues that very old Rubies (older than 2.2) used to encounter when compressing smaller payloads. This value has been lowered to 2KiB (2048 bytes), which should provide a more optimal balance between the CPU cycles spent on compression and the bandwidth savings gained from it.
Provide Code Level Metrics for New Relic CodeStream
For Ruby on Rails applications and/or those with manually traced methods, the agent is now capable of reporting metrics with Ruby method-level granularity. When the new
code_level_metrics.enabledconfiguration parameter is set to atruevalue, the agent will associate source-code-related metadata with the metrics for things such as Rails controller methods. Then, when the corresponding Ruby class file that defines the methods is loaded up in a New Relic CodeStream-powered IDE, the four golden signals for each method will be presented to the developer directly.Supportability Metrics will always report uncompressed payload size
New Relic's agent specifications call for Supportability Metrics to always reference the uncompressed payload byte size. Previously, the Ruby agent was calculating the byte size after compression. Furthermore, compression is only performed on payloads of a certain size. This means that sometimes the value could have represented a compressed size and sometimes an uncompressed one. Now the uncompressed value is always used, bringing consistency for comparing two instances of the same metric and alignment with the New Relic agent specifications.
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.5.0.357.
v8.7.0
APM logs-in-contextのログ転送がデフォルトで有効に
自動アプリケーションログ転送がデフォルトで有効になりました。このバージョンのエージェントは、エンリッチされたアプリケーションログをNew Relicに自動的に送信します。この機能の詳細についてはこちらをご覧ください。また、追加の設定オプションについてはこちらをご覧ください。アカウントごとにログの取り込みをオン/オフに切り替える方法については、こちらをご覧ください。
非同期サポートおよびスレッドの計装の改善
以前は、エージェントはすでに実行中のトランザクションの内部で作成されたスレッド内で、イベントとメトリクスを記録できませんでした。このリリースには、マルチスレッドアプリケーションによるスレッドの自動計装をサポートする2つの新しい設定オプションが含まれています。新しい設定オプションである
instrumentation.thread.tracing(デフォルトでは無効)が導入されました。これを有効にすると、エージェントはアプリケーションによって作成されたすべてのスレッド内にNew Relicトレースを挿入できるようになります。一部のスレッドのみをNew Relicによってインストゥルメントされた状態にしたいアプリケーションをサポートするために、New Relicの計装を含むスレッドを作成する新しいクラスNewRelic::TracedThreadを利用できます。詳細については、APIドキュメントをご覧ください。このリリースに含まれる新しい設定オプションは次のとおりです:
設定名
デフォルト
行動
instrumentation.threadauto(有効)エージェントが非同期トランザクション内にスパンを適切にネストできるようにします。
instrumentation.thread.tracingfalse(無効)アプリケーションで作成されたすべてのスレッドにトレースを自動的に追加します。これは、今後のリリースでデフォルトで有効になる可能性があります。
この機能のエントリーポイントをチームに提供するgistを共有していただいた@mikeantonelliに感謝いたします。
Ruby 2.2のサポートを非推奨化
Ruby 2.2は2018年3月31日にサポートを終了しました。エージェントはRuby 2.2のサポートを非推奨としました。次のメジャーリリースでは、このバージョンに対する破壊的変更が行われる予定です。
トランザクションイベントの更新された設定オプションを追加し、以前の設定を非推奨にしました。
このリリースでは、以下の計装が非推奨になります:
非推奨
置き換え
ActiveMerchant 1.64.0以下
ActiveMerchant 1.65.0以降
ActiveRecord 3.2.22.5以前
ActiveRecord 4.0.0以降
Acts As Solr(すべてのバージョン)
なし
Authlogic(すべてのバージョン)
なし
Bunny 2.6.7以前
Bunny 2.7.0以降
Dalli 2.7.6以前
Dalli 2.7.7以降
DataMapper(すべてのバージョン)
なし
Delayed Job 4.1.2以下
Delayed Job 4.1.3以降
Excon 0.55.0以下
Excon 0.56.0以降
Grape 0.19.1以前
Grape 0.19.2以降
HTTPClient 2.8.2.4以下
HTTPClient 2.8.3
HTTP.rb 2.2.1以前
HTTP.rb 2.2.2以降
Mongo 2.4.0以前
Mongo 2.4.1以上
Padrino 0.14.4以前
Padrino 0.15.0以降
Passenger 5.1.2以下
Passenger 5.1.3以降
Puma 3.8.2以前
Puma 3.9.0以降
Rack 1.6.7以下
Rack 1.6.8以降
Rails 3.2.22.5以前
Rails 4.0.0以降
Rainbows(全バージョン)
なし
Sequel 4.44.0以下
Sequel 4.45.0以降
Sidekiq 4.2.10以下
Sidekiq 5.0.0以降
Sinatra 1.4.8以下
Sinatra 2.0.0以降
Sunspot(すべてのバージョン)
なし
Typhoeus 1.1.2以下
Typhoeus 1.3.0以降
Unicorn 5.2.0以下
Unicorn 5.3.0以降
非推奨のバージョンを持つgemについては、今後multiverseスイートでそれらのバージョンのテストを行いません。ただし、引き続きエージェントと互換性がある場合があります。これらのバージョンのgemに関する問題のバグレポートについては、今後修正を行いません。
内部的に
Object.const_getを利用し、Object.const_defined?文字列からクラス定数を動的にチェックしたり、そのハンドルを取得したりする際は、可能な限り
Objectクラスの組み込みメソッドを活用して、よりシンプルでパフォーマンスの高い操作を実現してください。すべてのJRubyおよびv2.5以下のCRubyでは、指定されたものとは異なるネームスペースから意図しない定数が生成される可能性があるため、Objectが提供できる以上のサポートが少し必要になります。しかし、その他のすべてのRuby、そして入力される文字列値を100%信頼できるコンテキストにおけるRubyの場合であっても、Objectクラスのメソッドを活用してそのメリットを享受してください。rake.tasksの設定に関するドキュメントを明確化デフォルトの
newrelic.ymlファイル内のrake.tasksの説明、およびNew Relic Rubyエージェント設定ドキュメントが更新され、その動作と使用方法が明確になりました。現在、ドキュメントには次のように記載されています:自動的に計装するRakeタスクの配列を指定します。この設定オプションは、配列を正規表現リストに変換します。デフォルトで全てのタスクを許可したい場合は、
rake.tasks: [.+]を使用してください。このリストに追加されない限り、Rakeタスクはインストゥルメントされません。詳細については、(New RelicのRake計装に関するドキュメント)[/docs/apm/agents/ruby-agent/background-jobs/rake-instrumentation]を参照してください。これらの変更を提案していただいた@robotfelixに感謝いたします。
配列の設定を配列に変換する環境変数の設定を有効にします。
この変更以前は、カンマ区切りのリストが環境変数として渡された場合、
newrelic_agent.logにエラーが出力され、値として文字列が設定されていました。現在は、配列が正確に型変換されます。バグ修正:TransactionEventsが期待されるレートでサンプリングされるようにしました
TransactionEventAggregator内の
transaction_events.max_samples_storedのキャパシティ値が、想定される収集サイクルの間隔と一致しなかったため、TransactionEventsが過剰にサンプリングされていました。このバグ修正は、名前が変更されたtransaction_events*の設定に対して間隔とキャパシティが想定通りに機能するように、#952で行われた更新に基づいています。バグ修正:トランザクションの外部で作成された場合にエラーイベントの属性が欠落する問題
以前は、トランザクションのスコープ外でnotice_errorを呼び出すことによって作成されたエラーイベントに対し、エージェントは優先度を割り当てていませんでした。これにより、エラーイベントのバッファが満杯になったときにサンプリングの問題が発生し、newrelic_agent.logに
NoMethodError: undefined method '<' for nil:NilClassが出力されていました。このバグ修正により、エラーイベントには常に優先度が割り当てられるようになり、エージェントがこれらのエラーイベントを正しくサンプリングできるようになります。この問題を知らせていただいた@olleolleolleに感謝いたします。
サポートステートメント
New Relicでは、エージェントを定期的に、少なくとも3か月ごとにアップグレードすることを推奨します。このリリース以降、サポートされる最も古いバージョンは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_tracingwhich 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.gethostnameif 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_instrumentconfiguration 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_KEYandNEW_RELIC_HOSTenvironment 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
hostnamebinary 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
ParameterFilteringconstant 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
Dockerfileanddocker-compose.ymlfiles 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
Brewfilefile 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_modeto 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.