# AppSignal for Ruby gem Changelog ## 4.2.1 _Published on 2024-12-04._ ### Changed - Minimize difference between Rack transaction duration and total child event durations. (patch [95c37802](https://github.com/appsignal/appsignal-ruby/commit/95c3780291241fa6de8d2c0ae9bb09d3ce42d18d)) ## 4.2.0 _Published on 2024-11-13._ ### Added - Add `config/appsignal.rb` config file support. When a `config/appsignal.rb` file is present in the app, the Ruby gem will automatically load it when `Appsignal.start` is called. The `config/appsignal.rb` config file is a replacement for the `config/appsignal.yml` config file. When both files are present, only the `config/appsignal.rb` config file is loaded when the configuration file is automatically loaded by AppSignal when the configuration file is automatically loaded by AppSignal. Example `config/appsignal.rb` config file: ```ruby # config/appsignal.rb Appsignal.configure do |config| config.name = "My app name" end ``` To configure different option values for environments in the `config/appsignal.rb` config file, use if-statements: ```ruby # config/appsignal.rb Appsignal.configure do |config| config.name = "My app name" if config.env == "production" config.ignore_actions << "My production action" end if config.env == "staging" config.ignore_actions << "My staging action" end end ``` (minor [f81248bc](https://github.com/appsignal/appsignal-ruby/commit/f81248bc9c557197a0dd123c6d5958f21c11af9d), [48d16c7a](https://github.com/appsignal/appsignal-ruby/commit/48d16c7ab4dbc35ac3d56ecf042ca165d609bb64)) - Add the `config/appsignal.rb` Ruby config file method to installer, `appsignal install`. (patch [0d2e2bde](https://github.com/appsignal/appsignal-ruby/commit/0d2e2bde5da510f0d339673cdcdb9f79030acf59)) - Add `Appsignal.set_empty_params!` helper method. This helper method can be used to unset parameters on a transaction and to prevent the Appsignal instrumentation from adding parameters to a transaction. Example usage: ```ruby class PaymentsController < ApplicationController def create Appsignal.set_empty_params! # Do things with sensitive parameters end end ``` When `Appsignal.add_params` is called afterward, the "empty parameters" state is cleared and any AppSignal instrumentation (if called afterward) will also add parameters again. ```ruby # Example: Unset parameters when set Appsignal.add_params("abc" => "def") # Parameters: { "abc" => "def" } Appsignal.set_empty_params! # Parameters: {} # Example: When AppSignal instrumentation sets parameters: Appsignal.set_empty_params! # Parameters: {} # Pseudo example code: Appsignal::Instrumentation::SomeLibrary.new.add_params("xyz" => "...") # Parameters: {} # Example: Set parameters after them being unset previously Appsignal.set_empty_params! # Parameters: {} Appsignal.add_params("abc" => "def") # Parameters: { "abc" => "def" } ``` (patch [20a8050e](https://github.com/appsignal/appsignal-ruby/commit/20a8050e63605f08e9377dda84b3a422810dd49a), [23627cd7](https://github.com/appsignal/appsignal-ruby/commit/23627cd7e7c2b2939c43701228e77aa14eae5c68)) - Add `Appsignal.configure` context `env?` helper method. Check if the loaded environment matches the given environment using the `.env?(:env_name)` helper. Example: ```ruby Appsignal.configure do |config| # Symbols work as the argument if config.env?(:production) config.ignore_actions << "My production action" end # Strings also work as the argument if config.env?("staging") config.ignore_actions << "My staging action" end end ``` (patch [8b234cae](https://github.com/appsignal/appsignal-ruby/commit/8b234caee4c29f9550c4dc77d02ebd21f8dbfa30)) - Allow for default attributes to be given when initialising a `Logger` instance: ```ruby order_logger = Appsignal::Logger.new("app", attributes: { order_id: 123 }) ``` All log lines reported by this logger will contain the given attribute. Attributes given when reporting the log line will be merged with the default attributes for the logger, with those in the log line taking priority. (patch [27e05af6](https://github.com/appsignal/appsignal-ruby/commit/27e05af6cb1e1ebca1fd6e8038da290f42db2bdb), [8be7c791](https://github.com/appsignal/appsignal-ruby/commit/8be7c7912eea4d3df74f1ca8808b7d6e8802f550)) ### Changed - Read the Hanami Action name without metaprogramming in Hanami 2.2 and newer. This makes our instrumentation more stable whenever something changes in future Hanami releases. (patch [c6848504](https://github.com/appsignal/appsignal-ruby/commit/c68485043feee13a49400f57c9a77d48f670f0f2)) - Ignore these Hanami errors by default: - Hanami::Router::NotAllowedError (for example: sending a GET request to POST endpoint) - Hanami::Router::NotFoundError They are usually errors you don't want to be notified about, so we ignore them by default now. Customize the `ignore_errors` config option to continue receiving these errors. (patch [f1500987](https://github.com/appsignal/appsignal-ruby/commit/f1500987b7b73ab2873202ea7301f2cfb19acdc7)) ### Fixed - Fix request parameter reporting for Hanami 2.2. (patch [ca22ed54](https://github.com/appsignal/appsignal-ruby/commit/ca22ed54de513773c5ee387f28ad98ee8f301627)) ## 4.1.3 _Published on 2024-11-07._ ### Added - Add `activate_if_environment` helper for `Appsignal.configure`. Avoid having to add conditionals to your configuration file and use the `activate_if_environment` helper to specify for which environments AppSignal should become active. AppSignal will automatically detect the environment and activate itself it the environment matches one of the listed environments. ```ruby # Before Appsignal.configure do |config| config.active = Rails.env.production? || Rails.env.staging? end # After Appsignal.configure do |config| # Activate for one environment config.activate_if_environment(:production) # Activate for multiple environments config.activate_if_environment(:production, :staging) end ``` (patch [ff31be88](https://github.com/appsignal/appsignal-ruby/commit/ff31be88cf49a18951f48663d96af3cde4184e32)) - Add a hostname AppSignal tag automatically, based on the OpenTelemetry `host.name` resource attribute. (Beta only) (patch [35449268](https://github.com/appsignal/appsignal-ruby/commit/35449268a5f6d7487d17018ddb8f5dd433d676e0)) - Add incident error count metric for enriched OpenTelemetry traces. (Beta only) (patch [35449268](https://github.com/appsignal/appsignal-ruby/commit/35449268a5f6d7487d17018ddb8f5dd433d676e0)) - Set the app revision config option for Scalingo deploys automatically. If the `CONTAINER_VERSION` system environment variable is present, it will use used to set the `revision` config option automatically. Overwrite it's value by configuring the `revision` config option for your application. (patch [35449268](https://github.com/appsignal/appsignal-ruby/commit/35449268a5f6d7487d17018ddb8f5dd433d676e0)) ### Changed - Ignore the Rails healthcheck endpoint (Rails::HealthController#show) by default for Rails apps. If the `ignore_actions` option is set in the `config/appsignal.yml` file, the default is overwritten. If the `APPSIGNAL_IGNORE_ACTIONS` environment variable is set, the default is overwritten. When using the `Appsignal.configure` helper, add more actions to the default like so: ```ruby # config/appsignal.rb Appsignal.configure do |config| # Add more actions to ignore config.ignore_actions << "My action" end ``` To overwrite the default using the `Appsignal.configure` helper, do either of the following: ```ruby # config/appsignal.rb Appsignal.configure do |config| # Overwrite the default value, ignoring all actions ignored by default config.ignore_actions = ["My action"] # To only remove the healtcheck endpoint config.ignore_actions.delete("Rails::HealthController#show") end ``` (patch [af71fb90](https://github.com/appsignal/appsignal-ruby/commit/af71fb904eebc4af05dc2fcf8bd390dd9baffd68)) ### Fixed - Fix an issue where the extension fails to build on ARM64 Linux. (patch [79ac5bbe](https://github.com/appsignal/appsignal-ruby/commit/79ac5bbe7028151ae749cbd7a4e98f706d259ad8)) ## 4.1.2 _Published on 2024-10-04._ ### Changed - Change the primary download mirror for integrations. (patch [8fb8b93a](https://github.com/appsignal/appsignal-ruby/commit/8fb8b93af873735a33d9c9440260fd9afe9dd12b)) - Internal OpenTelemetry change. (patch [8fb8b93a](https://github.com/appsignal/appsignal-ruby/commit/8fb8b93af873735a33d9c9440260fd9afe9dd12b)) ### Fixed - Fix session data reporting for Action Cable actions. (patch [41642bea](https://github.com/appsignal/appsignal-ruby/commit/41642beace7e65f441a93319fbd94192c4d5aedf)) ## 4.1.1 _Published on 2024-09-28._ ### Changed - Add the `reported_by` tag to errors reported by the Rails error reporter so the source of the error is easier to identify. (patch [ff98ed67](https://github.com/appsignal/appsignal-ruby/commit/ff98ed677bf30242c51261bf7e44c9b6ba2f33ac)) ### Fixed - Fix no AppSignal internal logs being logged from Capistrano tasks. (patch [089d0325](https://github.com/appsignal/appsignal-ruby/commit/089d03251c3dc8b83658a4ebfade51ab6bed1771)) - Report all the config options set via `Appsignal.config` in the DSL config source in the diagnose report. Previously, it would only report the options from the last time `Appsignal.configure` was called. (patch [27b9aff7](https://github.com/appsignal/appsignal-ruby/commit/27b9aff7776646dfef6c55fa589024a71052e70b)) - Fix 'no implicit conversion of Pathname into String' error when parsing backtrace lines of error causes in Rails apps. (patch [b767f269](https://github.com/appsignal/appsignal-ruby/commit/b767f269c41cb7625d6869d8e8acb9b288292d19)) ## 4.1.0 _Published on 2024-09-26._ ### Added - Add support for heartbeat check-ins. Use the `Appsignal::CheckIn.heartbeat` method to send a single heartbeat check-in event from your application. This can be used, for example, in your application's main loop: ```ruby loop do Appsignal::CheckIn.heartbeat("job_processor") process_job end ``` Heartbeats are deduplicated and sent asynchronously, without blocking the current thread. Regardless of how often the `.heartbeat` method is called, at most one heartbeat with the same identifier will be sent every ten seconds. Pass `continuous: true` as the second argument to send heartbeats continuously during the entire lifetime of the current process. This can be used, for example, after your application has finished its boot process: ```ruby def main start_app Appsignal::CheckIn.heartbeat("my_app", continuous: true) end ``` (minor [7ae7152c](https://github.com/appsignal/appsignal-ruby/commit/7ae7152cddae7c257e9d62d3bf2433cce1f4287d)) - Include the first backtrace line from error causes to show where each cause originated in the interface. (patch [496b035a](https://github.com/appsignal/appsignal-ruby/commit/496b035a3510dbb6dc47c7c59172f488ec55c986)) ## 4.0.9 _Published on 2024-09-17._ ### Changed - Add the logger gem as a dependency. This fixes the deprecation warning on Ruby 3.3. (patch [8c1d577e](https://github.com/appsignal/appsignal-ruby/commit/8c1d577e4790185db887d49577cedc7d614d8d98)) - Do not report errors caused by `Errno::EPIPE` (broken pipe errors) when instrumenting response bodies, to avoid reporting errors that cannot be fixed by the application. (patch [1fdccba4](https://github.com/appsignal/appsignal-ruby/commit/1fdccba4ceeb8f9bb13ae077019b2c1f7d9d4fe4)) - Normalize Rack and Rails `UploadedFile` objects. Instead of displaying the Ruby class name, it will now show object details like the filename and content type. ``` # Before #<:multipart::uploadedfile> #<:http::uploadedfile> # After #<:multipart::uploadedfile original_filename: content_type:> #<:http::uploadedfile original_filename: content_type:> ``` (patch [bb50c933](https://github.com/appsignal/appsignal-ruby/commit/bb50c93387eafebe043b0e7f4083c95556b93136)) ## 4.0.8 _Published on 2024-09-13._ ### Fixed - Fix a `ThreadError` from being raised on process exit when `Appsignal.stop` is called from a `Signal.trap` block, like when Puma shuts down in clustered mode. (patch [32323ded](https://github.com/appsignal/appsignal-ruby/commit/32323ded277d4764ea1bd0d0dab02bef3de40ccb)) ## 4.0.7 _Published on 2024-09-12._ ### Changed - Format the Date and Time objects in a human-friendly way. Previously, dates and times stored in sample data, like session data, would be shown as `#` and `#