Changelog

Improving AppSignal, one deploy at a time.

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.

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!