Changelog

Improving AppSignal, one deploy at a time.

Jul 25, 2024

Fix monitor_and_stop helper block passing

Ruby3.12.1

Fixed

  • Fix Appsignal.monitor_and_stop block passing. It would error with a LocalJumpError. Thanks to @cwaider.

View the Ruby gem v3.12.1 changelog for more information.

Jul 25, 2024

Fix config defaults set from loader mechanism

Ruby3.12.2

Fixed

  • Fix the default env and root path for the integrations using loader mechanism. If APPSIGNAL_APP_ENV is set when using Appsignal.load(...), the AppSignal env set in APPSIGNAL_APP_ENV is now leading again.

View the Ruby gem v3.12.2 changelog for more information.

Jul 22, 2024

New configuration methods and integrations loader

Ruby3.12.0

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 to after_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 the Appsignal.config = Appsignal::Config.new(...) way of configuring AppSignal, should be updated to use the new Appsignal.configure method. The Appsignal::Config.new method would overwrite the given "initial config" with the config file's config and config read from environment variables. The Appsignal.configure method is leading. The config file, environment variables and Appsignal.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 about Appsignal.configure { ... } for the new way to configure AppSignal in Ruby.
  • Deprecate the Hanami integration require: require "appsignal/integrations/hanami". Use the new Appsignal.load(:hanami) method instead. Read our Hanami docs for more information.
  • Deprecate the Padrino integration require: require "appsignal/integrations/padrino". Use the new Appsignal.load(:padrino) method instead. Read our Padrino docs for more information.
  • Deprecate the Sinatra integration require: require "appsignal/integrations/sinatra". Use the new Appsignal.load(:sinatra) method instead. Read our Sinatra docs for more information.
  • Deprecate the Grape integration require: require "appsignal/integrations/grape". Use the new Appsignal.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.

Jul 15, 2024

New and improved instrumentation helpers

Ruby3.11.0

Added

  • Add Appsignal.monitor and Appsignal.monitor_and_stop instrumentation helpers. These helpers are a replacement for the Appsignal.monitor_transaction and Appsignal.monitor_single_transaction helpers.

    Use these new helpers to create an AppSignal transaction and track any exceptions that occur within the instrumented block. This new helper supports custom namespaces and has a simpler way to set an action name. Use this helper in combination with our other Appsignal.set_* helpers to add more metadata to the transaction.

    ruby
    # New helper Appsignal.monitor( :namespace => "my_namespace", :action => "MyClass#my_method" ) do # Track an instrumentation event Appsignal.instrument("my_event.my_group") do # Some code end end # Old helper Appsignal.monitor_transaction( "process_action.my_group", :class_name => "MyClass", :action_name => "my_method" ) do # Some code end

    The Appsignal.monitor_and_stop helper can be used in the same scenarios as the Appsignal.monitor_single_transaction helper is used. One-off Ruby scripts that are not part of a long running process.

    Read our instrumentation documentation for more information about using theAppsignal.monitor helper.

  • Add Appsignal.set_session_data helper. Set custom session data on the current transaction with the Appsignal.set_session_data helper. Note that this will overwrite any request session data that would be set automatically on the transaction. When this method is called multiple times, it will overwrite the previously set value.

    ruby
    Appsignal.set_session_data("data1" => "value1", "data2" => "value2")
  • Add Appsignal.set_headers helper. Set custom request headers on the current transaction with the Appsignal.set_headers helper. Note that this will overwrite any request headers that would be set automatically on the transaction. When this method is called multiple times, it will overwrite the previously set value.

    ruby
    Appsignal.set_headers("PATH_INFO" => "/some-path", "HTTP_USER_AGENT" => "Firefox")
  • Report request headers for webmachine apps.

Changed

  • Allow tags to have boolean (true/false) values.

    ruby
    Appsignal.set_tags("my_tag_is_amazing" => true) Appsignal.set_tags("my_tag_is_false" => false)
  • Optimize Sidekiq job arguments being recorded. Job arguments are only fetched and set when we sample the job transaction, which should decrease our overhead for all jobs we don't sample.

Deprecated

  • Deprecate Transaction sample helpers: Transaction#set_sample_data and Transaction#sample_data. Please use one of the other sample data helpers instead. See our sample data guide.

  • Deprecate the Appsignal::Transaction#set_http_or_background_queue_start method. Use the Appsignal::Transaction#set_queue_start helper instead.

  • Deprecate the Appsignal.without_instrumentation helper. Use the Appsignal.ignore_instrumentation_events helper instead.

  • Deprecate the Appsignal::Transaction::GenericRequest class. Use the Appsignal.set_* helpers to set metadata on the Transaction instead. Read our sample data guide for more information.

  • Deprecate the 'ID', 'request', and 'options' arguments for the Transaction.create and Transaction.new methods. To add metadata to the transaction, use the Appsignal.set_* helpers. Read our sample data guide for more information on how to set metadata on transactions.

    ruby
    # Before Appsignal::Transaction.create( SecureRandom.uuid, "my_namespace", Appsignal::Transaction::GenericRequest.new(env) # env is a request env Hash ) # After Appsignal::Transaction.create("my_namespace")
  • Deprecate the Appsignal.monitor_transaction and Appsignal.monitor_single_transaction helpers. See the entry about the replacement helpers Appsignal.monitor and Appsignal.monitor_and_stop.

View the Ruby gem v3.11.0 changelog for more information.

Jul 08, 2024

Improved web request instrumentation

Ruby3.10.0

Added

  • Add our new recommended Rack instrumentation middleware. If an app is using the Appsignal::Rack::GenericInstrumentation middleware, please update it to use Appsignal::Rack::InstrumentationMiddleware instead.

    This new middleware will not report all requests under the "unknown" action if no action name is set. To set an action name, call the Appsignal.set_action helper from the app.

    ruby
    # config.ru # Setup AppSignal use Appsignal::Rack::InstrumentationMiddleware # Run app
  • Add Rake task performance instrumentation. Configure the enable_rake_performance_instrumentation option to true to enable Rake task instrumentation for both error and performance monitoring. To ignore specific Rake tasks, configure ignore_actions to include the name of the Rake task.

  • Add instrumentation to Rack responses, including streaming responses. New process_response_body.rack and close_response_body.rack events will be shown in the event timeline. These events show how long it takes to complete responses, depending on the response implementation, and when the response is closed.

    This Sinatra route with a streaming response will be better instrumented, for example:

    ruby
    get "/stream" do stream do |out| sleep 1 out << "1" sleep 1 out << "2" sleep 1 out << "3" end end
  • Add the Appsignal.report_error helper to report errors. If you unsure whether to use the Appsignal.set_error or Appsignal.send_error helpers in what context, use Appsignal.report_error to always report the error.

  • Support nested webmachine apps. If webmachine apps are nested in other AppSignal instrumentation it will now report the webmachine instrumentation as part of the parent transaction, reporting more runtime of the request.

  • Report the response status for Padrino requests as the response_status tag on samples, e.g. 200, 301, 500. This tag is visible on the sample detail page. Report the response status for Padrino requests as the response_status metric.

  • Add support for nested Padrino apps. When a Padrino app is nested in another Padrino app, or another framework like Sinatra or Rails, it will now report the entire request.

  • Add Appsignal.set_params helper. Set custom parameters on the current transaction with the Appsignal.set_params helper. Note that this will overwrite any request parameters that would be set automatically on the transaction. When this method is called multiple times, it will overwrite the previously set value.

    ruby
    Appsignal.set_params("param1" => "value1", "param2" => "value2")
  • Add Appsignal.set_custom_data helper to set custom data on the transaction. Previously, this could only be set with Appsignal::Transaction.current.set_custom_data("custom_data", ...). This helper makes setting the custom data more convenient.

  • Add Appsignal.set_tags helper as an alias for Appsignal.tag_request. This is a context independent named alias available on the Transaction class as well.

  • Add a block argument to the Appsignal.set_params and Appsignal::Transaction#set_params helpers. When set_params is called with a block argument, the block is executed when the parameters are stored on the Transaction. This block is only called when the Transaction is sampled. Use this block argument to avoid having to parse parameters for every transaction, to speed things up when the transaction is not sampled.

    ruby
    Appsignal.set_params do # Some slow code to parse parameters JSON.parse('{"param1": "value1"}') end

Deprecated

  • Deprecate the appsignal.action and appsignal.route request env methods to set the transaction action name. Use the Appsignal.set_action helper instead.

    ruby
    # Before env["appsignal.action"] = "POST /my-action" env["appsignal.route"] = "POST /my-action" # After Appsignal.set_action("POST /my-action")
  • Deprecate the Appsignal::Rack::StreamingListener middleware. Use the Appsignal::Rack::InstrumentationMiddleware middleware instead.

  • Deprecate the Appsignal::Rack::GenericInstrumentation middleware. Use the Appsignal::Rack::InstrumentationMiddleware middleware instead. See also the changelog entry about the InstrumentationMiddleware.

Fixed

  • Fix issue with AppSignal getting stuck in a boot loop when loading the Padrino integration with: require "appsignal/integrations/padrino" This could happen in nested applications, like a Padrino app in a Rails app. AppSignal will now use the first config AppSignal starts with.
  • Fix the deprecation warning of Bundler.rubygems.all_specs usage.

View the Ruby gem v3.10.0 changelog for more information.

Jul 02, 2024

Support Hanami 2.1, improve GVL metrics, and more

Ruby3.9.3

Added

  • Track error response status for web requests. When an unhandled exception reaches the AppSignal EventHandler instrumentation, report the response status as 500 for the response_status tag on the transaction and on the response_status metric.

Changed

  • Require the AppSignal gem in the Grape integration file. Previously require "appsignal" had to be called before require "appsignal/integrations/grape". This require "appsignal" is no longer required.
  • Report Global VM Lock metrics per process. In addition to the existing hostname tag, add process_name and process_id tags to the gvl_global_timer and gvl_waiting_threads metrics emitted by the GVL probe, allowing these metrics to be tracked in a per-process basis.

Deprecated

  • Deprecate Appsignal::Grape::Middleware constant in favor of Appsignal::Rack::GrapeMiddleware constant.

    To fix this deprecation warning, update the usage of Appsignal::Grape::Middleware like this:

    ruby
    # Grape only apps insert_before Grape::Middleware::Error, Appsignal::Rack::GrapeMiddleware # or use Appsignal::Rack::GrapeMiddleware # Grape on Rails app use Appsignal::Rack::GrapeMiddleware
  • Deprecate the Appsignal.start_logger method. Remove this method call from apps if it is present. Calling Appsignal.start will now initialize the logger.

Fixed

  • Fix an issue with invalid request methods raising an error in the GenericInstrumentation middleware when using a request class that throws an error when calling the request_method method, like ActionDispatch::Request.
  • Support Grape apps that are nested in other apps like Sinatra and Rails, that also include AppSignal middleware for instrumentation.
  • Support Hanami version 2.1. On older versions of our Ruby gem it would error on an unknown keyword argument "sessions_enabled".
  • Fix issue with AppSignal getting stuck in a boot loop when loading the Hanami integration with: require "appsignal/integrations/hanami" This could happen in nested applications, like a Hanami app in a Rails app. It will now use the first config AppSignal starts with.

View the Ruby gem v3.9.3 changelog for more information.

Jun 26, 2024

Improved Hanami and Sinatra instrumentation

Ruby3.9.2

Added

  • Improve instrumentation of Hanami requests by making sure the transaction is always closed. It will also report a response_status tag and metric for Hanami requests.

Changed

  • Instrument the entire Sinatra request. Instrumenting Sinatra apps using require "appsignal/integrations/sinatra" will now report more of the request, if previously other middleware were not instrumented. It will also report the response status with the response_status tag and metric.

Fixed

  • Fix deprecation warnings about Transacation.params= usage by updating how we record parameters in our instrumentations.
  • Fix error reporting for requests with an error that use the AppSignal EventHandler.

View the Ruby gem v3.9.2 changelog for more information.

Jun 24, 2024

Fix parameter reporting for Sinatra and pure Rack apps

Ruby3.9.1

Fixed

  • Fix parameter reporting for Rack and Sinatra apps, especially POST payloads.

View the Ruby gem v3.9.1 changelog for more information.

Jun 21, 2024

Report Sidekiq job errors only on job discard

Ruby3.9.0

Added

  • Report Sidekiq errors when a job is dead/discarded. Configure the new sidekiq_report_errors config option to "discard" to only report errors when the job is not retried further.

Changed

  • Improve instrumentation for mounted Sinatra apps in Rails apps. The sample reported for the Sinatra request will now include the time spent in Rails and its middleware.
  • Support apps that have multiple Appsignal::Rack::EventHandler-s in the middleware stack.
  • Improve support for instrumentation of nested pure Rack and Sinatra apps. It will now report more of the request's duration and events. This also improves support for apps that have multiple Rack GenericInstrumentation or SinatraInstrumentation middlewares.

Fixed

  • Fix issue with AppSignal getting stuck in a boot loop when loading the Sinatra integration with: require "appsignal/integrations/sinatra" This could happen in nested applications, like a Sinatra app in a Rails app. It will now use the first config AppSignal starts with.

View the Ruby gem v3.9.0 changelog for more information.

Jun 17, 2024

Improved Rails request instrumentation

Ruby3.8.0

Changed

  • Report the time spent in Rails middleware as part of the request duration. The AppSignal Rack middleware is now higher in the middleware stack and reports more time of the request to give insights in how long other middleware took. This is reported under the new process_request.rack event in the event timeline.

Fixed

  • Fix ArgumentError being raised on Ruby logger and Rails.logger error calls. This fixes the error from being raised from within the AppSignal Ruby gem. Please do not use this for error reporting. We recommend using our error reporting feature instead to be notified of new errors. Read more on exception handling in Ruby with our Ruby gem.

    ruby
    # No longer raises an error Rails.logger.error StandardError.new("StandardError log message")

View the Ruby gem v3.8.0 changelog for more information.

Jun 17, 2024

Response code metric and tags for Rails apps

Ruby3.8.1

Added

  • Report the response status for Rails requests as the response_status tag on samples, e.g. 200, 301, 500. This tag is visible on the sample detail page.

    The response status is also reported as the response_status metric.

View the Ruby gem v3.8.1 changelog for more information.

Jun 11, 2024

Ruby gem v3.7.6

Ruby3.7.6

Changed

  • When the minutely probes thread takes more than 60 seconds to run all the registered probes, log an error. This helps find issues with the metrics reported by the probes not being accurately reported for every minute.
  • Internal agent changes for the Ruby gem.

View the Ruby gem v3.7.6 changelog for more information.

May 14, 2024

ViewComponent support and other improvements

Ruby3.7.5

Support events emitted by ViewComponent. Rendering of ViewComponent-based components will appear as events in your performance samples' event timeline.

For AppSignal to instrument ViewComponent events, you must first configure ViewComponent to emit those events:

ruby
# config/application.rb module MyRailsApp class Application < Rails::Application config.view_component.instrumentation_enabled = true config.view_component.use_deprecated_instrumentation_name = false end end

Thanks to Trae Robrock (@trobrock) for providing a starting point for this implementation!

Support Kamal-based deployments. Read the KAMAL_VERSION environment variable, which Kamal exposes within the deployed container, if present, and use it as the application revision if it is not set. This will automatically report deploy markers for applications using Kamal.

Fix an issue where an error about the AppSignal internal logger is raised when sending a heartbeat.

See the Ruby gem 3.7.5 changelog for more information.

May 09, 2024

Fix LocalJumpError on Active Job < 7.1

Ruby3.7.4

Fix LocalJumpError in Active Job instrumentation initialization for Active Job < 7.1.

See the Ruby gem 3.7.4 changelog for more information.

May 08, 2024

Report Active Job errors only on discard

Ruby3.7.3

Added

  • Add option to activejob_report_errors option to only report errors when a job is discard by Active Job. In the example below the job is retried twice. If it fails with an error twice the job is discarded. If activejob_report_errors is set to discard, you will only get an error reported when the job is discarded. This new discard value only works for Active Job 7.1 and newer.

    ruby
    class ExampleJob < ActiveJob::Base retry_on StandardError, :attempts => 2 # ... end

    More information in our Active Job documentation.

  • Track Active Job executions per job. When a job is retried the "executions" metadata for Active Job jobs goes up by one for every retry. We now track this as the executions tag on the job sample.

See the Ruby gem 3.7.3 changelog for more information.

May 06, 2024

Fix deprecation warnings

Ruby3.7.2

Fixed

  • Fix deprecation warnings for Probes.probes introduced in 3.7.1 for internally registered probes.

See the Ruby gem 3.7.2 changelog for more information.

Apr 29, 2024

Probe improvements and small fixes

Ruby3.7.1

Changed

  • If the gem can't find a valid log path in the app's log/ directory, it will no longer print the warning more than once.
  • Stop the minutely probes when Appsignal.stop is called. When Appsignal.stop is called, the probes thread will no longer continue running in the app process.
  • Listen to the APPSIGNAL_HTTP_PROXY environment variable in the extension installer. When APPSIGNAL_HTTP_PROXY is set during gem instal appsignal or bundle install, it will use the proxy specified in the APPSIGNAL_HTTP_PROXY environment variable to download the extension and agent.
  • Allow unregistering minutely probes. Use Appsignal::Probes.unregister to unregister probes registered with Appsignal::Probes.register if you do not need a certain probe, including default probes.
  • Add Appsignal::Probes.register method as the preferred method to register probes. The Appsignal::Probes.probes.register and Appsignal::Minutely.probes.register methods are now deprecated.
  • Automatically start new probes registered with Appsignal::Probes.register when the gem has already started the probes thread. Previously, the late registered probes would not be run.
  • Rename the Minutely constant to Probes so that the API is the same between AppSignal integrations. If your apps calls Appsignal::Minutely, please update it to Appsignal::Probes. If your app calls Appsignal::Minutely after this upgrade without the name change, the gem will print a deprecation warning for each time the Appsignal::Minutely is called.
  • Log debug messages when metrics are received for easier debugging.

Fixed

  • Clear the AppSignal in memory logger, used during the gem start, after the file/STDOUT logger is started. This reduces memory usage of the AppSignal Ruby gem by a tiny bit, and prevent stale logs being logged whenever a process gets forked and starts AppSignal.

See the Ruby gem 3.7.1 changelog for more information.

Apr 22, 2024

Add heartbeats and `ignore_logs` config option

Ruby3.7.0

ignore_logs configuration option

Add the ignore_logs configuration option, which can also be configured as the APPSIGNAL_IGNORE_LOGS environment variable.

The value of ignore_logs is a list (comma-separated, when using the environment variable) of log line messages that should be ignored. For example, the value "start" will cause any message containing the word "start" to be ignored. Any log line message containing a value in ignore_logs will not be reported to AppSignal.

The values can use a small subset of regular expression syntax (specifically, ^, $ and .*) to narrow or expand the scope of lines that should be matched.

For example, the value "^start$" can be used to ignore any message that is exactly the word "start", but not messages that merely contain it, like "Process failed to start". The value "Task .* succeeded" can be used to ignore messages about task success regardless of the specific task name.

Heartbeats

Heartbeats are currently only available to beta testers. If you are interested in trying it out, send an email to support@appsignal.com!


Add heartbeats support. You can send heartbeats directly from your code, to track the execution of certain processes:

ruby
def send_invoices() # ... your code here ... Appsignal.heartbeat("send_invoices") end

You can pass a block to Appsignal.heartbeat, to report to AppSignal both when the process starts, and when it finishes, allowing you to see the duration of the process:

ruby
def send_invoices() Appsignal.heartbeat("send_invoices") do # ... your code here ... end end

If an exception is raised within the block, the finish event will not be reported to AppSignal, triggering a notification about the missing heartbeat. The exception will bubble outside of the heartbeat block.


See the Ruby gem 3.7.0 changelog for more information.

Mar 25, 2024

Fix CPU usage measurements

Ruby3.6.4

Fix CPU user/system usage measurements, as to take into account the amount of CPUs available.

Mar 25, 2024

Fix instrumentation for older redis-client versions

Ruby3.6.5

Fix a bug where performing queries using older versions of redis-client would result in a NoMethodError being raised.

Using redis-client version 0.14.0 or greater is a requirement for AppSignal to instrument Redis queries.

See the Ruby gem 3.6.5 changelog for more information.

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!