New configuration methods and integrations loader
Added
-
Add a Rails configuration option to start AppSignal after Rails is initialized. By default, AppSignal will start before the Rails initializers are run. This way it is not possible to configure AppSignal in a Rails initializer using Ruby. To configure AppSignal in a Rails initializer, configure Rails to start AppSignal after it is initialized.
Ruby# config/application.rb # ... module MyApp class Application < Rails::Application # Add this line config.appsignal.start_at = :after_initialize # Other config end end
Then, in the initializer:
Ruby# config/initializers/appsignal.rb Appsignal.configure do |config| config.ignore_actions = ["My action"] end
Be aware that when
start_at
is set toafter_initialize
, AppSignal will not track any errors that occur when the initializers are run and the app fails to start.See our Rails documentation for more information.
-
Add a new method of configuring AppSignal:
Appsignal.configure
. This new method allows apps to configure AppSignal in Ruby.Ruby# The environment will be auto detected Appsignal.configure do |config| config.activejob_report_errors = "discard" config.sidekiq_report_errors = :discard config.ignore_actions = ["My ignored action", "My other ignored action"] config.request_headers << "MY_HTTP_HEADER" config.send_params = true config.enable_host_metrics = false end # Explicitly define which environment to start Appsignal.configure(:production) do |config| # Some config end
This new method can be used to update config in Ruby. We still recommend to use the
config/appsignal.yml
file to configure AppSignal whenever possible. Apps that use theAppsignal.config = Appsignal::Config.new(...)
way of configuring AppSignal, should be updated to use the newAppsignal.configure
method. TheAppsignal::Config.new
method would overwrite the given "initial config" with the config file's config and config read from environment variables. TheAppsignal.configure
method is leading. The config file, environment variables andAppsignal.configure
methods can all be mixed.See our configuration guide for more information.
Changed
-
Update the Sinatra, Padrino, Grape and Hanami integration setup for applications. Before this change a "appsignal/integrations/sinatra" file would need to be required to load the AppSignal integration for Sinatra. Similar requires exist for other libraries. This has changed to a new integration load mechanism.
This new load mechanism makes starting AppSignal more predictable when loading multiple integrations, like those for Sinatra, Padrino, Grape and Hanami.
Ruby# Sinatra example # Before require "appsignal/integrations/sinatra" # After require "appsignal" Appsignal.load(:sinatra) Appsignal.start
The
require "appsignal/integrations/sinatra"
will still work, but is deprecated in this release.See the documentation for the specific libraries for the latest on how to integrate AppSignal.
When using a combination of the libraries listed above, read our integration guide on how to load and configure AppSignal for multiple integrations at once.
-
Disable the AppSignal Rack EventHandler when AppSignal is not active. It would still trigger our instrumentation when AppSignal is not active. This reduces the instrumentation overhead when AppSignal is not active.
Deprecated
- Deprecate the
Appsignal.config = Appsignal::Config.new(...)
method of configuring AppSignal. See the changelog entry aboutAppsignal.configure { ... }
for the new way to configure AppSignal in Ruby. - Deprecate the Hanami integration require:
require "appsignal/integrations/hanami"
. Use the newAppsignal.load(:hanami)
method instead. Read our Hanami docs for more information. - Deprecate the Padrino integration require:
require "appsignal/integrations/padrino"
. Use the newAppsignal.load(:padrino)
method instead. Read our Padrino docs for more information. - Deprecate the Sinatra integration require:
require "appsignal/integrations/sinatra"
. Use the newAppsignal.load(:sinatra)
method instead. Read our Sinatra docs for more information. - Deprecate the Grape integration require:
require "appsignal/integrations/grape"
. Use the newAppsignal.load(:grape)
method instead. Read our Grape docs for more information.
Fixed
- Fix instrumentation events for response bodies appearing twice. When multiple instrumentation middleware were mounted in an application, it would create duplicate
process_response_body.rack
events.
View the Ruby gem v3.12.0 changelog for more information.