From 0c361971d6527dc20a0fa06e1a1fb9c08237e27d Mon Sep 17 00:00:00 2001 From: Dave Kroondyk Date: Fri, 27 Feb 2026 09:20:10 -0500 Subject: [PATCH] Track request queue time in sentry-rails Ensure the default behavior of start_transaction from the parent class `Sentry::Rack::CaptureExceptions` is executed when using Rails. --- .../lib/sentry/rails/capture_exceptions.rb | 16 ++++------------ .../lib/sentry/rack/capture_exceptions.rb | 2 ++ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/sentry-rails/lib/sentry/rails/capture_exceptions.rb b/sentry-rails/lib/sentry/rails/capture_exceptions.rb index 4f11a5eec..a9472cf86 100644 --- a/sentry-rails/lib/sentry/rails/capture_exceptions.rb +++ b/sentry-rails/lib/sentry/rails/capture_exceptions.rb @@ -36,19 +36,11 @@ def capture_exception(exception, env) end def start_transaction(env, scope) - options = { - name: scope.transaction_name, - source: scope.transaction_source, - op: transaction_op, - origin: SPAN_ORIGIN - } - - if @assets_regexp && scope.transaction_name.match?(@assets_regexp) - options.merge!(sampled: false) + super do |options| + if @assets_regexp && scope.transaction_name.match?(@assets_regexp) + options.merge!(sampled: false) + end end - - transaction = Sentry.continue_trace(env, **options) - Sentry.start_transaction(transaction: transaction, custom_sampling_context: { env: env }, **options) end def show_exceptions?(exception, env) diff --git a/sentry-ruby/lib/sentry/rack/capture_exceptions.rb b/sentry-ruby/lib/sentry/rack/capture_exceptions.rb index 8b38f6aac..4e9a403e4 100644 --- a/sentry-ruby/lib/sentry/rack/capture_exceptions.rb +++ b/sentry-ruby/lib/sentry/rack/capture_exceptions.rb @@ -71,6 +71,8 @@ def start_transaction(env, scope) origin: SPAN_ORIGIN } + yield(options) if block_given? + transaction = Sentry.continue_trace(env, **options) transaction = Sentry.start_transaction(transaction: transaction, custom_sampling_context: { env: env }, **options)