class Sentry::Rails::ActiveJobExtensions::SentryReporter

def record(job, &block)

def record(job, &block)
  Sentry.with_scope do |scope|
    begin
      scope.set_transaction_name(job.class.name)
      transaction =
        if job.is_a?(::Sentry::SendEventJob)
          nil
        else
          Sentry.start_transaction(name: scope.transaction_name, op: "active_job")
        end
      scope.set_span(transaction) if transaction
      yield.tap do
        finish_sentry_transaction(transaction, 200)
      end
    rescue Exception => e # rubocop:disable Lint/RescueException
      finish_sentry_transaction(transaction, 500)
      Sentry::Rails.capture_exception(
        e,
        extra: sentry_context(job),
        tags: {
          job_id: job.job_id,
          provider_job_id: job.provider_job_id
        }
      )
      raise
    end
  end
end