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)