New and improved instrumentation helpers
Added
-
Add
Appsignal.monitor
andAppsignal.monitor_and_stop
instrumentation helpers. These helpers are a replacement for theAppsignal.monitor_transaction
andAppsignal.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 theAppsignal.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 the
Appsignal.monitor
helper. -
Add
Appsignal.set_session_data
helper. Set custom session data on the current transaction with theAppsignal.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.RubyAppsignal.set_session_data("data1" => "value1", "data2" => "value2")
-
Add
Appsignal.set_headers
helper. Set custom request headers on the current transaction with theAppsignal.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.RubyAppsignal.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.
RubyAppsignal.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
andTransaction#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 theAppsignal::Transaction#set_queue_start
helper instead. -
Deprecate the
Appsignal.without_instrumentation
helper. Use theAppsignal.ignore_instrumentation_events
helper instead. -
Deprecate the
Appsignal::Transaction::GenericRequest
class. Use theAppsignal.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
andTransaction.new
methods. To add metadata to the transaction, use theAppsignal.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
andAppsignal.monitor_single_transaction
helpers. See the entry about the replacement helpersAppsignal.monitor
andAppsignal.monitor_and_stop
.
View the Ruby gem v3.11.0 changelog for more information.