Improved web request instrumentation
Added
-
Add our new recommended Rack instrumentation middleware. If an app is using the
Appsignal::Rack::GenericInstrumentation
middleware, please update it to useAppsignal::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 totrue
to enable Rake task instrumentation for both error and performance monitoring. To ignore specific Rake tasks, configureignore_actions
to include the name of the Rake task. -
Add instrumentation to Rack responses, including streaming responses. New
process_response_body.rack
andclose_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:
Rubyget "/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 theAppsignal.set_error
orAppsignal.send_error
helpers in what context, useAppsignal.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 theresponse_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 theAppsignal.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.RubyAppsignal.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 withAppsignal::Transaction.current.set_custom_data("custom_data", ...)
. This helper makes setting the custom data more convenient. -
Add
Appsignal.set_tags
helper as an alias forAppsignal.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
andAppsignal::Transaction#set_params
helpers. Whenset_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.RubyAppsignal.set_params do # Some slow code to parse parameters JSON.parse('{"param1": "value1"}') end
Deprecated
-
Deprecate the
appsignal.action
andappsignal.route
request env methods to set the transaction action name. Use theAppsignal.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 theAppsignal::Rack::InstrumentationMiddleware
middleware instead. -
Deprecate the
Appsignal::Rack::GenericInstrumentation
middleware. Use theAppsignal::Rack::InstrumentationMiddleware
middleware instead. See also the changelog entry about theInstrumentationMiddleware
.
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.