Sha256: 2c3a09dbe57109d3ec52aa7c88a24f57e6bc85caae26da5a636f71bb8c98636b

Contents?: true

Size: 535 Bytes

Versions: 2

Compression:

Stored size: 535 Bytes

Contents

module Sentry
  module Sidekiq
    class CleanupMiddleware
      def call(_worker, job, queue)
        return yield unless Sentry.initialized?

        Sentry.clone_hub_to_current_thread
        Sentry.with_scope do |scope|
          scope.set_extras(sidekiq: job.merge("queue" => queue))
          scope.set_transaction_name("Sidekiq/#{job["class"]}")

          begin
            yield
          rescue => ex
            Sentry.capture_exception(ex, hint: { background: false })
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sentry-sidekiq-4.1.1 lib/sentry/sidekiq/cleanup_middleware.rb
sentry-sidekiq-4.1.0 lib/sentry/sidekiq/cleanup_middleware.rb