# New Relic Ruby Agent Release Notes # ## v8.13.1 Version 8.13.1 of the agent provides a bugfix for Redis v5.0 instrumentation. * **Fix NoMethodError when using Sidekiq v7.0 with Redis Client v0.11** In some cases, the `RedisClient` object cannot directly access methods like db, port, or path. These methods are always available on the `client.config` object. This raised a `NoMethodError` in environments that used Sidekiq v7.0 and [Redis Client](https://rubygems.org/gems/redis-client) v0.11. Thank you to [fcheung](https://github.com/fcheung) and [@stevenou](https://github.com/stevenou) for bringing this to our attention! [Issue#1639](https://github.com/newrelic/newrelic-ruby-agent/issues/1639) ## v8.13.0 Version 8.13.0 of the agent updates our Rack, Redis, and Sidekiq instrumentation. It also delivers some bugfixes. * **Support for Redis v5.0** Redis v5.0 restructures where some of our instrumented methods are located and how they are named. It also introduces a new [instrumentation middleware API](https://github.com/redis-rb/redis-client#instrumentation-and-middlewares). This API is used for pipelined and multi calls to maintain reporting parity with previous Redis versions. However, it is introduced later in the chain, so you may see errors that used to appear at the segment level on the transaction instead. The agent's behavior when used with older supported Redis versions will remain unaffected. [PR#1611](https://github.com/newrelic/newrelic-ruby-agent/pull/1611) * **Support for Sidekiq v7.0** Sidekiq v7.0 removed Delayed Extensions and began offering client and server [middleware](https://github.com/mperham/sidekiq/blob/main/docs/middleware.md) classes to inherit from. The agent's Sidekiq instrumentation has been updated accordingly. The agent's behavior when used with older Sidekiq versions will remain unaffected. [PR#1615](https://github.com/newrelic/newrelic-ruby-agent/pull/1615) **NOTE:** an issue was discovered with Sidekiq v7.0+ and addressed by Ruby agent v8.13.1. If you are using Sidekiq, please skip Ruby agent v8.13.0 and use v8.13.1 or above. * **Support for Rack v3.0: Rack::Builder#new accepting a block** Via [rack/rack#1942](https://github.com/rack/rack/pull/1942) (released with Rack v3.0), `Rack::Builder#run` now optionally accepts a block instead of an app argument. The agent's instrumentation has been updated to support the use of a block with `Rack::Builder#run`. [PR#1600](https://github.com/newrelic/newrelic-ruby-agent/pull/1600) * **Bugfix: Correctly identify Unicorn, Rainbows and FastCGI with Rack v3.0** Unicorn, Rainbows, or FastCGI web applications using Rack v3.0 may previously have had the "dispatcher" value incorrectly reported as "Webrick" instead of "Unicorn", "Rainbows", or "FastCGI". This issue has now been addressed. [PR#1585](https://github.com/newrelic/newrelic-ruby-agent/pull/1585) * **Bugfix: add_method_tracer fails to record code level metric attributes on private methods** When using `add_method_tracer` on a private method, the agent was unable to record code level metrics for the method. This resulted in the following being logged to the newrelic_agent.log file. ``` WARN : Unable to determine source code info for 'Example', method 'private_method' - NameError: undefined method 'private_method' for class '#' ``` Thank you [@jdelStrother](https://github.com/jdelStrother) for bringing this issue to our attention and suggesting a fix! [PR#1593](https://github.com/newrelic/newrelic-ruby-agent/pull/1593) * **Bugfix: Category is a required keyword arg for NewRelic::Agent::Tracer.in_transaction** When support for Ruby 2.0 was dropped in version 8.0.0 of the agent, the agent API methods were updated to use the required keyword argument feature built into Ruby, rather than manually raising ArgumentErrors. The API method `NewRelic::Agent::Tracer.in_transaction` removed the ArgumentError raised by the agent, but did not update the method arguments to identify `:category` as a required keyword argument. This is now resolved. Thank you [@tatzsuzuki](https://github.com/tatzsuzuki) for bringing this to our attention. [PR#1587](https://github.com/newrelic/newrelic-ruby-agent/pull/1587) ## v8.12.0 Version 8.12.0 of the agent delivers new Elasticsearch instrumentation, increases the default number of recorded Custom Events, announces the deprecation of Ruby 2.3, and brings some valuable code cleanup. * **Support for Elasticsearch instrumentation** This release adds support to automatically instrument the [elasticsearch](https://rubygems.org/gems/elasticsearch) gem. Versions 7.x and 8.x are supported. [PR#1525](https://github.com/newrelic/newrelic-ruby-agent/pull/1525) | Configuration name | Default | Behavior | | ----------- | ----------- |----------- | | `instrumentation.elasticsearch` | auto | Controls auto-instrumentation of the elasticsearch library at start up. May be one of `auto`, `prepend`, `chain`, `disabled`. | | `elasticsearch.capture_queries` | true | If `true`, the agent captures Elasticsearch queries in transaction traces. | | `elasticsearch.obfuscate_queries` | true | If `true`, the agent obfuscates Elasticsearch queries in transaction traces. | * **Custom Event Limit Increase** This version increases the default limit of custom events from 1000 events per minute to 3000 events per minute. In the scenario that custom events were being limited, this change will allow more custom events to be sent to New Relic. There is also a new configurable maximum limit of 100,000 events per minute. To change the limits, see the documentation for [max_samples_stored](https://docs.newrelic.com/docs/apm/agents/ruby-agent/configuration/ruby-agent-configuration/#custom_insights_events-max_samples_stored). To learn more about the change and how to determine if custom events are being dropped, see our Explorers Hub [post](https://discuss.newrelic.com/t/send-more-custom-events-with-the-latest-apm-agents/190497). [PR#1541](https://github.com/newrelic/newrelic-ruby-agent/pull/1541) * **Deprecate support for Ruby 2.3** Ruby 2.3 reached end of life on March 31, 2019. The Ruby agent has deprecated support for Ruby 2.3 and will make breaking changes for this version in its next major release, v9.0.0 (release date not yet planned). All 8.x.x versions of the agent will remain compatible with Ruby 2.3. * **Cleanup: Remove orphaned code** In both the agent and unit tests, changes have taken place over the years that have left certain bits of code unreachable. This orphaned code can complicate code maintenance and refactoring, so getting it squared away can be very helpful. Commmuniy member [@ohbarye](https://github.com/ohbarye) contributed two separate cleanup PRs for this release; one for the agent and one for the tests. [PR#1537](https://github.com/newrelic/newrelic-ruby-agent/pull/1537) [PR#1548](https://github.com/newrelic/newrelic-ruby-agent/pull/1548) Thank you to [@ohbarye](https://github.com/ohbarye) for contributing this helpful cleanup! ## 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 deployments` command** Previously, the `newrelic deployments` command 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 using `api_key`. When this configuration option is present, the `newrelic deployments` command will automatically use the New Relic REST API v2 deployment endpoint. [PR#1461](https://github.com/newrelic/newrelic-ruby-agent/pull/1461) Thank you to [@Arkham](https://github.com/Arkham) for bringing this to our attention! * **Cleanup: Performance tests, constants, rubocop-minitest assertions and refutations** Community member [@esquith](https://github.com/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](https://github.com/newrelic/newrelic-ruby-agent/pull/1406) [PR#1408](https://github.com/newrelic/newrelic-ruby-agent/pull/1408) [PR#1409](https://github.com/newrelic/newrelic-ruby-agent/pull/1409) [PR#1411](https://github.com/newrelic/newrelic-ruby-agent/pull/1411) Thank you [@esquith](https://github.com/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](https://github.com/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](https://github.com/newrelic/newrelic-ruby-agent/pull/1519) This is much appreciated! Thank you, [@luigieai](https://github.com/luigieai). * **Spelling corrections** Community member [@jsoref](https://github.com/jsoref), author of the [Check Spelling](https://github.com/marketplace/actions/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](https://github.com/newrelic/newrelic-ruby-agent/pull/1508) Thank you very much, [@jsoref](https://github.com/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](https://github.com/newrelic/newrelic-ruby-agent/pull/1436) * **Bugfix: Fix memory leak in the Curb instrumentation** Community member [@charkost](https://github.com/charkost) was able to rework the `on_failure` callback logic prepped via the agent's Curb instrumentation in order to avoid some nesting that was causing memory leaks. [PR#1518](https://github.com/newrelic/newrelic-ruby-agent/pull/1518) Many thanks for both the heads up on the issue and the fix, [@charkost](https://github.com/charkost)! ## v8.10.1 * **Bugfix: Missing unscoped metrics when instrumentation.thread.tracing is enabled** Previously, when `instrumentation.thread.tracing` was 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. ## v8.10.0 * **New gRPC instrumentation** The agent will now instrument [gRPC](https://grpc.io/) activity performed by clients and servers that use the [grpc](https://rubygems.org/gems/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_client` | auto | Set to 'disabled' to disable, set to 'chain' if there are module prepending conflicts | | `instrumentation.grpc_server` | auto | 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](https://docs.newrelic.com/docs/apm/agents/ruby-agent/features/ruby-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](https://github.com/rmosolgo/graphql-ruby/issues/3945). That Issue essentially notes that the New Relic Ruby agent incurs a significant performance hit when the `graphql` RubyGem (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: true` magic 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_f`** Originally, the agent was only checking the `transaction_tracer.transaction_threshold` from the newrelic.yml correctly if it was on two lines. Example: ``` # newrelic.yml transaction_tracer: transaction_threshold: apdex_f ``` When this was instead changed to be on one line, the agent was not able to correctly identify the value of apdex_f. Example: ``` # newrelic.yml transaction_tracer.transaction_threshold: apdex_f ``` This 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 line `transaction_tracer.transaction_threshold: apdex_f` correctly 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 Logger` to 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. ## 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. This method can leverage error handling to allow the instrumentation to gracefully log a message and exit the stuck Resque job. ## v8.8.0 * **Support Makara database adapters with ActiveRecord** Thanks to a community submission from @lucasklaassen with [PR #1177](https://github.com/newrelic/newrelic-ruby-agent/pull/1177), the Ruby agent will now correctly work well with the [Makara gem](https://github.com/instacart/makara). 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 (< 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.enabled` configuration parameter is set to a `true` value, 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](https://www.codestream.com/)-powered IDE, [the four golden signals](https://sre.google/sre-book/monitoring-distributed-systems/) 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. ## 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 this feature see [here](https://docs.newrelic.com/docs/apm/new-relic-apm/getting-started/get-started-logs-context/), and additional configuration options are available [here](https://docs.newrelic.com/docs/logs/logs-context/configure-logs-context-ruby). To learn about how to toggle log ingestion on or off by account see [here](https://docs.newrelic.com/docs/logs/logs-context/disable-automatic-logging). * **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](https://www.rubydoc.info/gems/newrelic_rpm/NewRelic) 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 asynchronous 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. * **Deprecate instrumentation versions with low adoption and/or versions over five years old** This release deprecates the following instrumentation: | Deprecated | Replacement | | ----------- | ----------- | | ActiveMerchant < 1.65.0 | ActiveMerchant >= 1.65.0 | | Acts As Solr (all versions) | none | | Authlogic (all versions) | none | | Bunny < 2.7.0 | bunny >= 2.7.0 | | Dalli < 3.2.1 | Dalli >= 3.2.1 | | DataMapper (all versions) | none | | Delayed Job < 4.1.0 | Delayed Job >= 4.1.0 | | Excon < 0.56.0 | Excon >= 0.56.0 | | Grape < 0.19.2 | Grape >= 0.19.2 | | HTTPClient < 2.8.3 | HTTPClient 2.8.3 | | HTTP.rb < 2.2.2 | HTTP.rb >= 2.2.2 | | Mongo < 2.4.1 | Mongo >= 2.4.1 | | Padrino < 0.15.0 | Padrino >= 0.15.0 | | Passenger < 5.1.3 | Passenger >= 5.1.3 | | Puma < 3.9.0 | Puma >= 3.9.0 | | Rack < 1.6.8 | Rack >= 1.6.8 | | Rails 3.2.x | Rails >= 4.x | | Rainbows (all versions) | none | | Sequel < 4.45.0 | Sequel >= 4.45.0 | | Sidekiq < 5.0.0 | Sidekiq >= 5.0.0 | | Sinatra < 2.0.0 | Sinatra >= 2.0.0 | | Sunspot (all versions) | none | | Typhoeus < 1.3.0 | Typhoeus >= 1.3.0 | | Unicorn < 5.3.0 | Unicorn >= 5.3.0 | 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 related to these gem versions. * **Clarify documentation for `rake.tasks` configuration** The `rake.tasks` description in the default `newrelic.yml` file and the [New Relic Ruby Agent Configuration docs](https://docs.newrelic.com/docs/apm/agents/ruby-agent/configuration/ruby-agent-configuration#rake-tasks) 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. * **Internally leverage `Object.const_get` and `Object.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 what `Object` 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 the `Object` class's methods and reap the benefits. * **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](https://github.com/newrelic/newrelic-ruby-agent/pull/952) so that the interval and capacity behave as expected for the renamed `transaction_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. ## 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](https://docs.newrelic.com/docs/apm/agents/ruby-agent/configuration/ruby-agent-configuration/). * **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](https://github.com/newrelic/newrelic-ruby-agent/issues/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](https://github.com/newrelic/newrelic-ruby-agent/issues/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` and `NEW_RELIC_HOST` environment variables were present. Now, tests will discard these environment variables before running. * **Bugfix: Curb - satisfy 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](https://github.com/newrelic/newrelic-ruby-agent/issues/1033) for more details. ## 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](https://github.com/newrelic/newrelic-ruby-agent/pull/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` and `docker-compose.yml` files in the project root. See [DOCKER.md](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](https://github.com/newrelic/newrelic-ruby-agent/pull/919), [PR #921](https://github.com/newrelic/newrelic-ruby-agent/pull/921), and [PR #922](https://github.com/newrelic/newrelic-ruby-agent/pull/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](test/multiverse/README.md) 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/or `monitor_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! ## 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. ## v8.2.0 * **New Instrumentation for Tilt gem** Template rendering using [Tilt](https://github.com/rtomayko/tilt) is now instrumented. See [PR #847](https://github.com/newrelic/newrelic-ruby-agent/pull/847) for details. * **Configuration `error_collector.ignore_errors` is marked as deprecated** This 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! ## 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 the `newrelic.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 referenced `self.class` which is not available on `BasicObjects`. This has been fixed. Thanks to @toncid for bringing this issue to our attention. ## v8.0.0 * **`add_method_tracer` refactored to use prepend over alias_method chaining** This release overhauls the implementation of `add_method_tracer`, as detailed in [issue #502](https://github.com/newrelic/newrelic-ruby-agent/issues/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: ```ruby # OLD add_method_tracer :foo, '#{args[0]}.#{args[1]}' # NEW add_method_tracer :foo, -> (*args) { "#{args[0]}.#{args[1]}" } ``` - Similarly, the `:code_header` and `:code_footer` options to `add_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 to `add_method_tracer` as an array. See updated documentation on the following pages for full details: - [Ruby Custom Instrumentation: Method Tracers](https://docs.newrelic.com/docs/agents/ruby-agent/api-guides/ruby-custom-instrumentation/#method_tracers) - [MethodTracer::ClassMethods#add_method_tracer](https://rubydoc.info/github/newrelic/newrelic-ruby-agent/NewRelic/Agent/MethodTracer/ClassMethods#add_method_tracer-instance_method) * **Distributed tracing is enabled by default** [Distributed tracing](https://docs.newrelic.com/docs/distributed-tracing/enable-configure/language-agents-enable-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](https://docs.newrelic.com/docs/agents/ruby-agent/features/cross-application-tracing-ruby/). * **Bugfix: Incorrectly loading configuration options from newrelic.yml** The agent will now import the configuration options [`error_collector.ignore_messages`](https://docs.newrelic.com/docs/agents/ruby-agent/configuration/ruby-agent-configuration/#error_collector-ignore_messages) and [`error_collector.expected_messages`](https://docs.newrelic.com/docs/agents/ruby-agent/configuration/ruby-agent-configuration/#error_collector-expected_messages) from the `newrelic.yml` file correctly. * **Cross Application is now deprecated, and disabled by default** [Distributed tracing](https://docs.newrelic.com/docs/distributed-tracing/enable-configure/language-agents-enable-distributed-tracing/) is replacing [cross application tracing](https://docs.newrelic.com/docs/agents/ruby-agent/features/cross-application-tracing-ruby/) as the default means of tracing between services. To continue using it, enable it with `cross_application_tracer.enabled: true` and `distributed_tracing.enabled: false` * **Update configuration option default value for `span_events.max_samples_stored` from 1000 to 2000** For more information about this configuration option, visit [the Ruby agent documentation](https://docs.newrelic.com/docs/agents/ruby-agent/configuration/ruby-agent-configuration/#span_events-max_samples_stored). * **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`](https://docs.newrelic.com/docs/agents/ruby-agent/configuration/ruby-agent-configuration/#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 to `Process.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](https://weblog.rubyonrails.org/2008/12/23/merb-gets-merged-into-rails-3/) 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+** ## v7.2.0 * **Expected Errors and Ignore Errors** This release adds support for configuration for 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](https://docs.newrelic.com/docs/agents/ruby-agent/configuration/) * **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 occurring 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'. ## 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 method browser_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 for `sql.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 the `connection` 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. ## 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](https://docs.newrelic.com/docs/agents/ruby-agent/getting-started/migration-7x-guide/) for helpful strategies and tips for migrating from earlier versions of the Ruby agent to 7.0.0. We cover new configuration settings, diagnosing 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. No code changes that would prevent the agent from continuing to work with these releases are known. 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 (a.k.a. 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 is known that some external gems lead to Stack Level too Deep exceptions when prepend and method-chaining are mixed. In such known cases, 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 with `http.statusCode`. This deprecated attribute has now been removed. * **Removed deprecated option in notice_error** Previously, the `:trace_only` option to NewRelic::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` and `accept_distributed_trace_payload` were deprecated. These have now been removed. Instead, please see `insert_distributed_trace_headers` and `accept_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. Sintra 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 start up 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 segments length resulting in an exception when attempting to nest the initial segment which does not exist. ## 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 recorded** Previously, 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 an attempt to call `descendant_complete` on a Nil object. This is fixed to protect against calling the `descendant_complete` in such cases. * **Feature: implements `force_install_exit_handler` config flag** The `force_install_exit_handler` configuration flag allows an application to instruct the agent to install its graceful shutdown exit handler, which will send any locally cached data to the New Relic collector prior to the application shutting down. This is useful for 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 to true. However, many gems are still using monkey patching on Net::HTTP, which causes compatibility issues with using prepend. Defaulting this to false minimizes instances of unexpected compatibility issues. ## 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 erroneously 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 reproducible 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 path** Previously, when a user specifies a `newrelic.yml.erb` and no `newrelic.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 programmatically. The `newrelic.yml.erb` filename is restored to the search path and will be utilized if present. NOTE: `newrelic.yml` still takes precedence over `newrelic.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 falsely 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. ## 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. ## v6.13.0 * **Bugfix: never use redirect host when accessing preconnect endpoint** When connecting to New Relic, the Ruby Agent uses the value in `Agent.config[:host]` to post a request to the New Relic preconnect endpoint. This endpoint returns a "redirect host" which is the URL to which agents send data from that point on. Previously, if the agent needed to reconnect to the collector, it would incorrectly use this redirect host to call the preconnect endpoint, when it should have used the original configured value in `Agent.config[:host]`. The agent now uses the correct host for all calls to preconnect. * **Bugfix: calling `add_custom_attributes` no longer modifies the params of the caller** The previous agent's improvements to recording attributes at the span level had an unexpected side-effect of modifying the params passed to the API call as duplicated attributes were deleted in the process. This is now fixed and params passed in are no longer modified. Thanks to Pete Johns (@johnsyweb) for the PR that resolves this bug. * **Bugfix: `http.url` query parameters spans are now obfuscated** Previously, the agent was recording the full URL of the external requests, including the query and fragment parts of the URL as part of the attributes on the external request span. This has been fixed so that the URL is obfuscated to filter out potentially sensitive data. * **Use system SSL certificates by default** The Ruby agent previously used a root SSL/TLS certificate bundle by default. Now the agent will attempt to use the default system certificates, but will fall back to the bundled certs if there is an issue (and log that this occurred). * **Bugfix: reduce allocations for segment attributes** Previously, every segment received an `Attributes` object on initialization. The agent now lazily creates attributes on segments, resulting in a significant reduction in object allocations for a typical transaction. * **Bugfix: eliminate errors around Rake::VERSION with Rails** When running a Rails application with rake tasks, customers could see the following error: * **Prevent connecting agent thread from hanging on shutdown** A bug in `Net::HTTP`'s Gzip decoder can cause the (un-catchable) thread-kill exception to be replaced with a (catchable) `Zlib` exception, which prevents a connecting agent thread from exiting during shutdown, causing the Ruby process to hang indefinitely. This workaround checks for an `aborting` thread in the `#connect` exception handler and re-raises the exception, allowing a killed thread to continue exiting. Thanks to Will Jordan (@wjordan) for chasing this one down and patching with tests. * **Fix error messages about Rake instrumentation** When running a Rails application with rake tasks, customers could see the following error in logs resulting from a small part of rake functionality being loaded with the Rails test runner: ``` ERROR : Error while detecting rake_instrumentation: ERROR : NameError: uninitialized constant Rake::VERSION ``` Such error messages should no longer appear in this context. Thanks to @CamilleDrapier for pointing out this issue. * **Remove NewRelic::Metrics** The `NewRelic::Metrics` module has been removed from the agent since it is no longer used. Thanks to @csaura for the contribution! ## v6.12.0 * The New Relic Ruby Agent is now open source under the [Apache 2 license](LICENSE) and you can now observe the [issues we're working on](https://github.com/orgs/newrelic/projects/17). See our [Contributing guide](https://github.com/newrelic/newrelic-ruby-agent/blob/main/CONTRIBUTING.md) and [Code of Conduct](https://github.com/newrelic/.github/blob/master/CODE_OF_CONDUCT.md) for details on contributing! * **Security: Updated all uses of Rake to >= 12.3.3** All versions of Rake testing prior to 12.3.3 were removed to address [CVE-2020-8130](https://nvd.nist.gov/vuln/detail/CVE-2020-8130). No functionality in the agent was removed nor deprecated with this change, and older versions of rake are expected to continue to work as they have in the past. However, versions of rake < 12.3.3 are no longer tested nor supported. * **Bugfix: fixes an error capturing content length in middleware on multi-part responses** In the middleware tracing, the `Content-Length` header is sometimes returned as an array of values when content is a multi-part response. Previously, the agent would fail with "NoMethodError: undefined method `to_i` for Array" Error. This bug is now fixed and multi-part content lengths are summed for a total when an `Array` is present. * **Added support for auto-instrumenting Mongo gem versions 2.6 to 2.12** * **Bugfix: MongoDB instrumentation did not handle CommandFailed events when noticing errors** The mongo gem sometimes returns a CommandFailed object instead of a CommandSucceeded object with error attributes populated. The instrumentation did not handle noticing errors on CommandFailed objects and resulted in logging an error and backtrace to the log file. Additionally, a bug in recording the metric for "findAndModify" as all lowercased "findandmodify" for versions 2.1 through 2.5 was fixed. * **Bugfix: Priority Sampler causes crash in high throughput environments in rare cases** Previously, the priority sampling buffer would, in rare cases, generate an error in high-throughput environments once capacity is reached and the sampling algorithm engages. This issue is fixed. * **Additional Transaction Information applied to Span Events** When Distributed Tracing and/or Infinite Tracing are enabled, the Agent will now incorporate additional information from the Transaction Event on to the root Span Event of the transaction. The following items are affected: * Custom attribute values applied to the Transaction via our [add_custom_attributes](http://www.rubydoc.info/github/newrelic/newrelic-ruby-agent/NewRelic/Agent#add_custom_attributes-instance_method) API method. * Request parameters: `request.parameters.*` * Request headers: `request.headers.*` * Response headers: `response.headers.*` * Resque job arguments: `job.resque.args.*` * Sidekiq job arguments: `job.sidekiq.args.*` * Messaging arguments: `message.*` * `httpResponseCode` (deprecated in this version; see note below)/`http.statusCode` * `response.status` * `request.uri` * `request.method` * `host.displayName` * **Security Recommendation** Review your Transaction attributes [include](https://docs.newrelic.com/docs/agents/ruby-agent/attributes/enable-disable-attributes-ruby#transaction_events-attributes-include) and [exclude](https://docs.newrelic.com/docs/agents/ruby-agent/attributes/enable-disable-attributes-ruby#transaction_events-attributes-exclude) configurations. Any attribute include or exclude settings specific to Transaction Events should be applied to your Span attributes [include](https://docs.newrelic.com/docs/agents/ruby-agent/attributes/enable-disable-attributes-ruby#span-events-attributes-include) and [exclude](https://docs.newrelic.com/docs/agents/ruby-agent/attributes/enable-disable-attributes-ruby#span-events-attributes-exclude) configuration or your global attributes [include](https://docs.newrelic.com/docs/agents/ruby-agent/attributes/enable-disable-attributes-ruby#attributes-include) and [exclude](https://docs.newrelic.com/docs/agents/ruby-agent/attributes/enable-disable-attributes-ruby#attributes-exclude) configuration. * **Agent attribute deprecation: httpResponseCode** Starting in this agent version, the [agent attribute](https://docs.newrelic.com/docs/agents/ruby-agent/attributes/ruby-agent-attributes#attributes) `httpResponseCode` (string value) has been deprecated. Customers can begin using `http.statusCode` (integer value) immediately, and `httpResponseCode` will be removed in the agent's next major version update. * **Bugfix: Eliminate warnings for distributed tracing when using sidekiq** Previously, using sidekiq with distributed tracing disabled resulted in warning messages\ `WARN : Not configured to accept distributed trace headers`\ ` WARN : Not configured to insert distributed trace headers`\ These messages no longer appear. ## v6.11.0 * **Infinite Tracing** This release adds support for [Infinite Tracing](https://docs.newrelic.com/docs/understand-dependencies/distributed-tracing/enable-configure/enable-distributed-tracing). Infinite Tracing observes 100% of your distributed traces and provides visualizations for the most actionable data. With Infinite Tracing, you get examples of errors and long-running traces so you can better diagnose and troubleshoot your systems. Configure your agent to send traces to a trace observer in New Relic Edge. View distributed traces through New Relic’s UI. There is no need to install a collector on your network. Infinite Tracing is currently available on a sign-up basis. If you would like to participate, please contact your sales representative. * **Bugfix: Cross Application Tracing (CAT) adds a missing field to response** Previously, the Ruby agent's Cross Application Tracing header was missing a reserved field that would lead to an error in the Go agent's processing of incoming headers from the Ruby agent. This fix adds that missing field to the headers, eliminating the issue with traces involving the Ruby agent and the Go agent. * **Bugfix: Environment Report now supports Rails >= 6.1** Previously, users of Rails 6.1 would see the following deprecation warning appear when the Ruby agent attempted to collect enviroment data: `DEPRECATION WARNING: [] is deprecated and will be removed from Rails 6.2`. These deprecation methods no longer appear. Thanks to Sébastien Dubois (sedubois) for reporting this issue and for the contribution! * **Added distributed tracing to Sidekiq jobs** Previously, Sidekiq jobs were not included in portions of distributed traces captured by the Ruby agent. Now you can view distributed traces that include Sidekiq jobs instrumented by the Ruby agent. Thanks to andreaseger for the contribution! * **Bugfix: Eliminate warnings appearing when using `add_method_tracer` with Ruby 2.7** Previously, using `add_method_tracer` with Ruby 2.7 to trace a method that included keyword arguments resulted in warning messages: `warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call`. These messages no longer appear. Thanks to Harm de Wit and Atsuo Fukaya for reporting the issue! ## v6.10.0 * **Error attributes now added to each span that exits with an error or exception** Error attributes `error.class` and `error.message` are now included on the span event in which an error or exception was noticed, and, in the case of unhandled exceptions, on any ancestor spans that also exit with an error. The public API method `notice_error` now attaches these error attributes to the currently executing span. Spans with error details are now highlighted red in the Distributed Tracing UI, and error details will expose the associated `error.class` and `error.message`. It is also now possible to see when an exception leaves the boundary of the span, and if it is caught in an ancestor span without reaching the entry span. NOTE: This “bubbling up” of exceptions will impact the error count when compared to prior behavior for the same trace. It is possible to have a trace that now has span errors without the trace level showing an error. If multiple errors occur on the same span, only the most recent error information is added to the attributes. Prior errors on the same span are overwritten. These span event attributes conform to ignored errors and expected errors. * **Added tests for latest Grape / Rack combination** For a short period of time, the latest versions of Grape and Rack had compatibility issues. Generally, Rack 2.1.0 should be avoided in all cases due to breaking changes in many gems reliant on Rack. We recommend using either Rack <= 2.0.9, or using latest Rack when using Grape (2.2.2 at the time of this writing). * **Bugfix: Calculate Content-Length in bytes** Previously, the Content-Length HTTP header would be incorrect after injecting the Browser Monitoring JS when the response contained Unicode characters because the value was not calculated in bytes. The Content-Length is now correctly updated. Thanks to thaim for the contribution! * **Bugfix: Fix Content-Length calculation when response is nil** Previously, calculating the Content-Length HTTP header would result in a `NoMethodError` in the case of a nil response. These errors will no longer occur in such a case. Thanks to Johan Van Ryseghem for the contribution! * **Bugfix: DecoratingFormatter now logs timestamps as millisecond Integers** Previously the agent sent timestamps as a Float with milliseconds as part of the fractional value. Logs in Context was changed to only accept Integer values and this release changes DecoratingFormatter to match. * **Added --force option to `newrelic install` cli command to allow overwriting newrelic.yml** * **Bugfix: The fully qualified hostname now works correctly for BSD and Solaris** Previously, when running on systems such as BSD and Solaris, the agent was unable to determine the fully qualified domain name, which is used to help link Ruby agent data with data from New Relic Infrastructure. This information is now successfully collected on various BSD distros and Solaris. ## v6.9.0 * **Added support for W3C Trace Context, with easy upgrade from New Relic trace context** * [Distributed Tracing now supports W3C Trace Context headers](https://docs.newrelic.com/docs/understand-dependencies/distributed-tracing/get-started/introduction-distributed-tracing#w3c-support) for HTTP protocols when distributed tracing is enabled. Our implementation can accept and emit both the W3C trace header format and the New Relic trace header format. This simplifies agent upgrades, allowing trace context to be propagated between services with older and newer releases of New Relic agents. W3C trace header format will always be accepted and emitted. New Relic trace header format will be accepted, and you can optionally disable emission of the New Relic trace header format. * When distributed tracing is enabled by setting `distributed_tracing.enabled` to `true`, the Ruby agent will now accept W3C's `traceparent` and `tracestate` headers when calling `DistributedTracing.accept_distributed_trace_headers` or automatically via `http` instrumentation. When calling `DistributedTracing.insert_distributed_trace_headers`, or automatically via `http` instrumentation, the Ruby agent will include the W3C headers along with the New Relic distributed tracing header, unless the New Relic trace header format is disabled by setting `exclude_newrelic_header` setting to `true`. * Added `DistributedTracing.accept_distributed_trace_headers` API for accepting both New Relic and W3C TraceContext distributed traces. * Deprecated `DistributedTracing.accept_distributed_trace_payload` which will be removed in a future major release. * Added `DistributedTracing.insert_distributed_trace_headers` API for adding outbound distributed trace headers. Both W3C TraceContext and New Relic formats will be included unless `distributed_tracing.exclude_newrelic_header: true`. * Deprecated `DistributedTracing.create_distributed_trace_payload` which will be removed in a future major release. Known Issues and Workarounds * If a .NET agent is initiating traces as the root service, do not upgrade your downstream Ruby New Relic agents to this agent release. * **Official Ruby 2.7 support** The Ruby agent has been verified to run with Ruby 2.7.0. * **Reduced allocations when tracing transactions using API calls** Default empty hashes for `options` parameter were not frozen, leading to excessive and unnecessary allocations when calling APIs for tracing transactions. Thanks to Joel Turkel (jturkel) for the contribution! * **Bugfix for Resque worker thread race conditions** Recent changes in Rack surfaced issues marshalling data for resque, surfaced a potential race-condition with closing out the worker-threads before flushing the data pipe. This is now fixed. Thanks to Bertrand Paquet (bpaquet) for the contribution! * **Bugfix for Content-Length when injecting Browser Monitoring JS** The Content-Length HTTP header would be incorrect after injecting the Browser Monitoring JS into the HEAD tag of the HTML source with Content-Length and lead to the HTML BODY content being truncated in some cases. The Content-Length is now correctly updated after injecting the Browser Monitoring JS script. Thanks to Slava Kardakov (ojab) for the contribution! ## v6.8.0 * **Initial Ruby 2.7 support** The Ruby agent has been verified to run with Ruby 2.7.0-preview1. * **New API method to add custom attributes to Spans** New API method for adding custom attributes to spans. Previously, custom attributes were only available at the Transaction level. Now, with Span level custom attributes, more granular tagging of events is possible for easier isolation and review of trace events. For more information: * [`Agent#add_custom_span_attributes`](https://www.rubydoc.info/github/newrelic/newrelic-ruby-agent/NewRelic/Agent#add_custom_span_attributes) * **Enables ability to migrate to Configurable Security Policies (CSP) on a per agent basis for accounts already using High Security Mode (HSM).** When both [HSM](https://docs.newrelic.com/docs/agents/manage-apm-agents/configuration/high-security-mode) and [CSP](https://docs.newrelic.com/docs/agents/manage-apm-agents/configuration/enable-configurable-security-policies) are enabled for an account, an agent (this version or later) can successfully connect with either `high_security: true` or the appropriate `security_policies_token` configured. `high_security` has been added as part of the preconnect payload. * **Bugfix for Logs in Context combined with act-fluent-logger-rails** Previously, when using the Ruby agent's Logs in Context logger to link logging data with trace and entity metadata for an improved experience in the UI, customers who were also using the `act-fluent-logger-rails` gem would see a `NoMethodError` for `clear_tags!` that would interfere with the use of this feature. This error no longer appears, allowing customers to combine the use of Logs in Context with the use of this gem. Please note that the Logs in Context logger does not support tagged logging; if you are initializing your logger with a `log_tags` argument, your custom tags may not appear on the final version of your logs. * **Bugfix for parsing invalid newrelic.yml** Previously, if the newrelic.yml configuration file was invalid, and the agent could not start as a result, the agent would not log any indication of the problem. This version of the agent will emit a FATAL message to STDOUT when this scenario occurs so that customers can address issues with newrelic.yml that prevent startup. * **Configuration options containing the terms "whitelist" and "blacklist" deprecated** The following local configuration settings have been deprecated: * `autostart.blacklisted_constants`: use `autostart.denylisted_constants` instead. * `autostart.blacklisted_executables`: use `autostart.denylisted_executables` instead. * `autostart.blacklisted_rake_tasks`: use `autostart.denylisted_rake_tasks` instead. * `strip_exception_messages.whitelist`: use `strip_exception_messages.allowed_classes` instead. * **Bugfix for module loading and constant resolution in Rails** Starting in version 6.3, the Ruby agent has caused module loading and constant resolution to sometimes fail, which caused errors in some Rails applications. These errors were generally `NoMethodError` exceptions or I18n errors `translation missing` or `invalid locale`. These errors would not appear if the agent was removed from the application's Gemfile. This version of the agent fixes these issues with module loading and constant resolution, so these errors no longer occur. * **Bugfix: failed to get urandom** Previous versions of the agent would fail unexpectedly when the Ruby process used every available file descriptor. The failures would include this message: ``` ERROR : RuntimeError: failed to get urandom ``` This version of the agent uses a different strategy for generating random IDs, and will not fail in the same way when no file descriptors are available. ## v6.7.0 * **Trace and Entity Metadata API** Several new API methods have been added to the agent: * [`Agent#linking_metadata`](https://www.rubydoc.info/github/newrelic/newrelic-ruby-agent/NewRelic/Agent#linking_metadata-instance_method) * [`Tracer#trace_id`](https://www.rubydoc.info/github/newrelic/newrelic-ruby-agent/NewRelic/Agent/Tracer#trace_id-class_method) * [`Tracer#span_id`](https://www.rubydoc.info/github/newrelic/newrelic-ruby-agent/NewRelic/Agent/Tracer#span_id-class_method) * [`Tracer#sampled?`](https://www.rubydoc.info/github/newrelic/newrelic-ruby-agent/NewRelic/Agent/Tracer#sampled?-class_method) These API methods allow you to access information that can be used to link data of your choosing to a trace or entity. * **Logs in Context** This version of the agent includes a logger, which can be used in place of `::Logger` from the standard library, or `ActiveSupport::Logger` from Rails. This logger leverages the new trace and entity metadata API to decorate log statements with entity and trace metadata, so they can be correlated together in the New Relic UI. For more information on how to use logs in context, see https://docs.newrelic.com/docs/enable-logs-context-ruby * **Project metadata in Gemspec** Project metadata has been added to the gemspec file. This means our Rubygems page will allow users to more easily access the agent's source code, raise issues, and read the changelog. Thanks to Orien Madgwick for the contribution! ## v6.6.0 * **Bugfix for ActionCable Instrumentation** Previous versions of the agent sometimes caused application crashes with some versions of ActionCable. The application would exit quickly after startup with the error: `uninitialized constant ActionCable::Engine`. Version 6.6.0 of the agent no longer crashes in this way. * **Handling of disabling Error Collection** When the agent first starts, it begins collecting Error Events and Traces before fetching configuration from New Relic. In previous versions of the agent, those events or traces would be sent to New Relic, even if _Error Collection_ is disabled in the application's server-side configuration. Version 6.6.0 of the agent drops all collected Error Events and Traces if the configuration from the server disables _Error Collection_. ## v6.5.0 * **Change to default setting for ActiveRecord connection resolution** Due to incompatibilities between the faster ActiveRecord connection resolution released in v6.3.0 of the agent and other gems which patch ActiveRecord, `backport_fast_active_record_connection_lookup` will now be set to `false` by default. Because it results in a significant performance improvement, we recommend customers whose environments include ActiveRecord change this setting to `true` _unless_ they are using other gems which measure ActiveRecord performance, which may lose functionality when combined with this setting. If unsure whether to enable `backport_fast_active_record_connection_lookup`, we recommend enabling it in a development environment to make sure other gems which patch ActiveRecord are still working as expected. * **Bugfix for ActiveStorage instrumentation error** Version 6.4.0 of the agent introduced a bug that interfered with ActiveStorage callbacks, resulting in the agent being unable to instrument ActiveStorage operations. ActiveStorage segments are now correctly recorded. * **Bugfix for ActiveRecord 4.1 and 4.2 exception logging** Version 6.3.0 of the agent introduced a bug that prevented ActiveRecord versions 4.1 and 4.2 from logging exceptions that occurred within a database transaction. This version of the agent restores the exception logging functionality from previous agent versions. Thanks to Oleksiy Kovyrin for the contribution! ## v6.4.0 * **Custom Metadata Collection** The agent now collects environment variables prefixed by `NEW_RELIC_METADATA_`. These may be added to transaction events to provide context between your Kubernetes cluster and your services. For details on the behavior, see [this blog post](https://blog.newrelic.com/engineering/monitoring-application-performance-in-kubernetes/). * **Bugfix for faster ActiveRecord connection resolution** Version 6.3.0 of the agent backported the faster ActiveRecord connection resolution from Rails 6.0 to previous versions, but the implementation caused certain other gems which measured ActiveRecord performance to stop working. This version of the agent changes the implementation of this performance improvement so no such conflicts occur. * **Bugfix for Grape instrumentation error** Previous versions of the agent would fail to install Grape instrumentation in Grape versions 1.2.0 and up if the API being instrumented subclassed `Grape::API::Instance` rather than `Grape::API`. A warning would also print to the newrelic_agent log: ``` WARN : Error in Grape instrumentation WARN : NoMethodError: undefined method `name' for nil:NilClass ``` This version of the agent successfully installs instrumentation for subclasses of `Grape::API::Instance`, and these log messages should no longer appear. * **Bugfix for streaming responses** Previous versions of the agent would attempt to insert JavaScript instrumentation into any streaming response that did not make use of `ActionController::Live`. This resulted in an empty, non-streamed response being sent to the client. This version of the agent will not attempt to insert JavaScript instrumentation into a response which includes the header `Transfer-Encoding=chunked`, which indicates a streaming response. This should exclude JavaScript instrumentation for all streamed responses. To include this instrumentation manually, see [Manually instrument via agent API](https://docs.newrelic.com/docs/agents/ruby-agent/features/new-relic-browser-ruby-agent#manual_instrumentation) in our documentation. ## v6.3.0 * **Official Rails 6.0 support** This version of the agent has been verified against the Rails 6.0.0 release. As ActiveRecord 4, 5, and 6 use the same New Relic instrumentation, the `disable_active_record_4` and `disable_active_record_5` settings in NewRelic.yml are being deprecated in favor of the new `disable_active_record_notifications`. This new setting will affect the instrumentation of ActiveRecord 4, 5, and 6. The deprecated settings will be removed in a future release. * **Bugfix for `newrelic deployments` script** For applications housed in the EU, the `newrelic deployments` script included with previous versions of the agent would fail with the following message: `Deployment not recorded: Application does not exist.` This is because the script would attempt to send the deployment notification to the US region. The deployment script now sends deployments to the correct region. * **Faster ActiveRecord connection resolution** This version of the agent uses the faster ActiveRecord connection resolution that Rails 6.0 uses, even on previous versions of Rails. Thanks to Callum Jones for the contribution! * **Support non-ascii characters in hostnames** Previous versions of the agent would frequently log warnings like: `log writing failed. "\xE2" from ASCII-8BIT to UTF-8` if the hostname contained a non-ascii character. This version of the agent will no longer log these warnings. Thanks to Rafael Petry for the contribution! ## v6.2.0 * Bugfix for superfluous `Empty JSON response` error messages Version 6.1.0 of the agent frequently logged error messages about an empty JSON response, when no error had occurred. These logs no longer appear. * Bugfix for `Unable to calculate elapsed transaction time` warning messages Ruby Agent versions 5.4 through 6.1, when running in jruby without ObjectSpace enabled, would occasionally log a warning indicating that the agent was unable to calculate the elapsed transaction time. When this log statement appeared, the affected transactions would not be included in the data displayed on the capacity analysis page. These transactions are now correctly recorded. ## v6.1.0 * Performance monitoring on Kubernetes This release adds Transaction event attributes that provide context between your Kubernetes cluster and services. For details on the benefits, see this [blog post](https://blog.newrelic.com/engineering/monitoring-application-performance-in-kubernetes/). * Bugfix for Bunny instrumentation when popping empty queues When a customer calls `Bunny::Queue#pop` on an empty queue, Bunny returns a `nil` value. Previous Ruby Agent versions raised a `NoMethodError` when trying to process this result. Now, the agent correctly skips processing for `nil` values. Thanks to Matt Campbell for the contribution. ## v6.0.0 * Tracer API for flexible custom instrumentation With agent version 6.0, we are introducing the `Tracer` class, an officially supported public API for more flexible custom instrumentation. By calling its `in_transaction` method, you can instrument an arbitrary section of Ruby code without needing to juggle any explicit state. Behind the scenes, the agent will make sure that the measured code results in an APM segment inside a transaction. The same API contains additional methods for creating transactions and segments, and for interacting with the current transaction. For more details, see the [custom instrumentation documentation](https://docs.newrelic.com/docs/agents/ruby-agent/api-guides/ruby-custom-instrumentation). If you were previously using any of the agent's private, undocumented APIs, such as `Transaction.wrap` or `Transaction.start/stop`, you will need to update your code to use the Tracer API. The full list of APIs that were removed or deprecated are: * `External.start_segment` * `Transaction.create_segment` * `Transaction.start` * `Transaction.stop` * `Transaction.start_datastore_segment` * `Transaction.start_segment` * `Transaction.wrap` * `TransactionState.current_transaction` If are you using any of these APIs, please see the [upgrade guide](https://docs.newrelic.com/docs/agents/ruby-agent/troubleshooting/update-private-api-calls-public-tracer-api) for a list of replacements. * Agent detects Rails 6.0 The agent properly detects Rails 6.0 and no longer logs an error when started in a Rails 6.0 environment. This does not include full Rails 6.0 support, which will be coming in a future release. Thanks to Jacob Bednarz for the contribution. ## v5.7.0 * Ruby 2.6 support We have tested the agent with the official release of Ruby 2.6.0 made on December 25, 2018, and it looks great! Feel free to use agent v5.7 to measure the performance of your Ruby 2.6 applications. * Support for loading Sequel core standalone Earlier versions of the agent required users of the Sequel data mapping library to load the _entire_ library. The agent will now enable Sequel instrumentation when an application loads Sequel's core standalone; i.e., without the `Sequel::Model` class. Thanks to Vasily Kolesnikov for the contribution! * Grape 1.2 support With agent versions 5.6 and earlier, Grape 1.2 apps reported their transactions under the name `Proc#call` instead of the name of the API endpoint. Starting with agent version 5.7, all existing versions of Grape will report the correct transaction name. Thanks to Masato Ohba for the contribution! ## v5.6.0 * Bugfix for transactions with `ActionController::Live` Previously, transactions containing `ActionController::Live` resulted in incorrect calculations of capacity analysis as well as error backtraces appearing in agent logs in agent versions 5.4 and later. The agent now correctly calculates capacity for transactions with `ActionController::Live`. * Add ability to exclude attributes from span events and transaction segments Agent versions 5.5 and lower could selectively exclude attributes from page views, error traces, transaction traces, and transaction events. With agent version 5.6 and higher, you can also exclude attributes from span events (via the `span_events.include/exclude` options) and from transaction segments (via the `transaction_segments.include/exclude` options). As with other attribute destinations, these new options will inherit values from the top-level `attributes.include/exclude` settings. See the [documentation](https://docs.newrelic.com/docs/agents/ruby-agent/attributes/enabling-disabling-attributes-ruby) for more information. * Increasing backoff sequence on failing to connect to New Relic If the agent cannot reach New Relic, it will now wait for an increasing amount of time after each failed attempt. We are also starting with a shorter delay initially, which will help customer apps bounce back more quickly from transient network errors. * Truncation of long stack traces Previous versions of the agent would truncate long stack traces to 50 frames. To give customers more flexibility, we have added the `error_collector.max_backtrace_frames` configuration option. Thanks to Patrick Tulskie for the contribution! * Update link in documentation The community forum link in `README.md` now goes to the updated location. Thanks to Sam Killgallon for the contribution! * Active Storage instrumentation The agent now provides instrumentation for Active Storage, introduced in Rails 5.2. Customers will see Active Storage operations represented as segments within transaction traces. ## v5.5.0 * Bugfix for `perform` instrumentation with curb gem Use of curb's `perform` method now no longer results in nil headers getting returned. * Bugfix for parsing Docker container IDs The agent now parses Docker container IDs correctly regardless of the cgroup parent. * Use lazy load hooks for ActiveJob instrumentation In some instances the ActiveJob instrumentation could trigger ActiveJob to load before it was initialized by Rails. This could result in configuration changes not being properly applied. The agent now uses lazy load hooks which fixes this issue. * Documentation improvement The `config.dot` diagram of the agent's configuration settings no longer includes the deleted `developer_mode` option. Thanks to Yuichiro Kaneko for the contribution! ## v5.4.0 * Capacity analysis for multi-threaded dispatchers Metrics around capacity analysis did not previously account for multi-threaded dispatchers, and consequently could result in capacities of over 100% being recorded. This version now properly accounts for multi-threaded dispatchers. * `NewRelic::Agent.disable_transaction_tracing` deprecated `NewRelic::Agent.disable_transaction_tracing` has been deprecated. Users are encouraged to use `NewRelic::Agent.disable_all_tracing` or `NewRelic::Agent.ignore_transaction` instead. * Bugfix for SQL over-obfuscation A bug, introduced in v5.3.0, where SQL could be over-obfuscated for some database adapters has been fixed. * Bugfix for span event data in Resque processes A bug where span events would not be sent from Resque processes due to a missing endpoint has been fixed. ## v5.3.0 ## * Distributed Tracing Distributed tracing lets you see the path that a request takes as it travels through your distributed system. By showing the distributed activity through a unified view, you can troubleshoot and understand a complex system better than ever before. Distributed tracing is available with an APM Pro or equivalent subscription. To see a complete distributed trace, you need to enable the feature on a set of neighboring services. Enabling distributed tracing changes the behavior of some New Relic features, so carefully consult the [transition guide](https://docs.newrelic.com/docs/transition-guide-distributed-tracing) before you enable this feature. To enable distributed tracing, set the `distributed_tracing.enabled` configuration option to `true`. ## v5.2.0 ## * Use priority sampling for errors and custom events Priority sampling replaces the older reservoir event sampling method. With this change, the agent will maintain randomness across a given time period while improving coordination among transactions, errors, and custom events. * Bugfix for wrapping datastore operations The agent will now complete the process of wrapping datastore operations even if an error occurs during execution of a callback. * Span Events Finished segments whose `sampled` property is `true` will now post Span events to Insights. ## v5.1.0 ## * Rails 5.2 support The Ruby agent has been validated against the latest release of Ruby on Rails! * Support for newer libraries and frameworks We have updated the multiverse suite to test the agent against current versions of several frameworks. * Add `custom_attributes.enabled` configuration option This option is enabled by default. When it's disabled, custom attributes will not be transmitted on transaction events or error events. * Fix Grape load order dependency The agent will now choose the correct name for Grape transactions even if the customer's app loads the agent before Grape. Thanks to Daniel Doubrovkine for the contribution! * Add `webpacker:compile` to blacklisted tasks `webpacker:compile` is commonly used for compiling assets. It has been added to `AUTOSTART_BLACKLISTED_RAKE_TASKS` in the default configuration. Thanks to Claudio B. for the contribution! * Make browser instrumentation W3C-compliant `type="text/javascript"` is optional for the `