lib/sentry/rails/tracing/abstract_subscriber.rb in sentry-rails-5.2.1 vs lib/sentry/rails/tracing/abstract_subscriber.rb in sentry-rails-5.3.0

- old
+ new

@@ -38,18 +38,15 @@ end def record_on_current_span(duration:, **options) return unless options[:start_timestamp] - scope = Sentry.get_current_scope - transaction = scope.get_transaction - return unless transaction && transaction.sampled - - span = transaction.start_child(**options) - # duration in ActiveSupport is computed in millisecond - # so we need to covert it as second before calculating the timestamp - span.set_timestamp(span.start_timestamp + duration / 1000) - yield(span) if block_given? + Sentry.with_child_span(**options) do |child_span| + # duration in ActiveSupport is computed in millisecond + # so we need to covert it as second before calculating the timestamp + child_span.set_timestamp(child_span.start_timestamp + duration / 1000) + yield(child_span) if block_given? + end end end end end end