Changelog

Improving AppSignal, one deploy at a time.

Aug 23, 2024

AppSignal for Ruby Version 4.0

Ruby4.0.0

We've released version 4.0 of the AppSignal gem! Read all about it in the Ruby gem 4.0 blog post.

When upgrading, follow our guide for upgrading from Ruby gem 3 to 4.

Added

  • Add an at_exit callback error reporter. By default, AppSignal will now report any unhandled errors that crash the process as long as Appsignal started beforehand.

    Ruby
    require "appsignal" Appsignal.start raise "oh no!" # Will report the error StandardError "oh no!"

    To disable this behavior, set the enable_at_exit_reporter config option to false.

  • Report errors from Rails runners. When a Rails runner reports an unhandled error, it will now report the error in the "runner" namespace.

  • Support adding multiple errors to a transaction.

    Using the Appsignal.report_error helper, you can now report more than one error within the same transaction context, up to a maximum of ten errors per transaction. Each error will be reported as a separate sample in the AppSignal UI.

    Before this change, using Appsignal.report_error or Appsignal.set_error helpers, adding a new error within the same transaction would overwrite the previous one.

  • Add a helper for parameters sample data to be unset. This is a private method until we stabilize it.

Changed

  • Change the default Rake task namespace to "rake". Previously, Rake tasks were reported in the "background" namespace.

  • Do not start AppSignal when the config file raises an error. Previously, the file source would be ignored.

  • Freeze the config after AppSignal has started. Prevent the config from being modified after AppSignal has started to avoid the expectation that modifying the config after starting AppSignal has any effect.

  • Do not start Appsignal multiple times if Appsignal.start is called more than once. The configuration can no longer be modified after AppSignal has started.

  • The transaction sample data is now merged by default. Previously, the sample data (except for tags) would be overwritten when a sample data helper was called.

    Ruby
    # Old behavior Appsignal.set_params("param1" => "value") Appsignal.set_params("param2" => "value") # The parameters are: # { "param2" => "value" } # New behavior Appsignal.add_params("param1" => "value") Appsignal.add_params("param2" => "value") # The parameters are: # { "param1" => "value", "param2" => "value" }

    New helpers have been added:

    • Appsignal.add_tags
    • Appsignal.add_params
    • Appsignal.add_session_data
    • Appsignal.add_headers
    • Appsignal.add_custom_data

    The old named helpers that start with set_ will still work. They will also use the new merging behavior.

  • Set the Rails config defaults for Appsignal.configure when used in a Rails initializer. Now when using Appsignal.configure in a Rails initializer, the Rails env and root path are set on the AppSignal config as default values and do not need to be manually set.

  • Global transaction metadata helpers now work inside the Appsignal.report_error and Appsignal.send_error callbacks. The transaction yield parameter will continue to work, but we recommend using the global Appsignal.set_* and Appsignal.add_* helpers.

    Ruby
    # Before Appsignal.report_error(error) do |transaction| transaction.set_namespace("my namespace") transaction.set_action("my action") transaction.add_tags(:tag_a => "value", :tag_b => "value") # etc. end Appsignal.send_error(error) do |transaction| transaction.set_namespace("my namespace") transaction.set_action("my action") transaction.add_tags(:tag_a => "value", :tag_b => "value") # etc. end # After Appsignal.report_error(error) do Appsignal.set_namespace("my namespace") Appsignal.set_action("my action") Appsignal.add_tags(:tag_a => "value", :tag_b => "value") # etc. end Appsignal.send_error(error) do Appsignal.set_namespace("my namespace") Appsignal.set_action("my action") Appsignal.add_tags(:tag_a => "value", :tag_b => "value") # etc. end
  • Include the Rails app config in diagnose report. If AppSignal is configured in a Rails initializer, this config is now included in the diagnose report.

  • Include the config options from the loaders config defaults and the Appsignal.configure helper in diagnose report. The sources for config option values will include the loaders and Appsignal.configure helper in the output and the JSON report sent to our severs, when opted-in.

  • Calculate error rate by transactions with an error, not the number of errors on a transaction. This limits the error rate to a maximum of 100%.

Removed

  • Remove all deprecated components. Please follow our Ruby gem 4 upgrade guide when upgrading to this version to avoid any errors from calling removed components, methods and helpers.
  • Remove the Appsignal.listen_for_error helper. Use manual exception handling using rescue => error with the Appsignal.report_error helper instead.
  • Remove (private) Appsignal::Transaction::FRONTEND constant. This was previously used for the built-in front-end integration, but this has been absent since version 3 of the Ruby gem.
  • Remove the Appsignal.config= writer. Use the Appsignal.configure helper to configure AppSignal.
  • Remove the Transaction.new method Transaction ID argument. The Transaction ID will always be automatically generated.

Fixed

  • Fix an issue where, when setting several errors for the same transaction, error causes from a different error would be shown for an error that has no causes.

View the Ruby gem v4.0.0 changelog for more information.

View all Ruby updates

Start your free trial

Don’t let the bad bugs bite. Try AppSignal for free.

AppSignal offers a 30-day free trial, no credit card is required. All features are available in all plans. Start monitoring your application in just a few clicks!