Changelog

Improving AppSignal, one deploy at a time.

Nov 13, 2024

Add configuration via Ruby file and other improvements

Ruby4.2.0

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
  • Add the config/appsignal.rb Ruby config file method to installer, appsignal install.

  • 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" }
  • 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
  • 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.

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.

  • 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.

Fixed

  • Fix request parameter reporting for Hanami 2.2.

View the Ruby gem v4.2.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!