Sha256: 5a24b62bc99d1a733b058472bb58ce29ebd01a08215b2fcd684475e687a1b142

Contents?: true

Size: 659 Bytes

Versions: 2

Compression:

Stored size: 659 Bytes

Contents

require 'time'
require 'sidekiq'

module Raven
  class Sidekiq
    def call(worker, msg, queue)
      started_at = Time.now
      yield
    rescue => ex
      Raven.capture_exception(ex, :extra => { :sidekiq => msg },
                                  :time_spent => Time.now-started_at)
      raise
    end
  end
end

if Sidekiq::VERSION < '3'
  # old behavior
  ::Sidekiq.configure_server do |config|
    config.server_middleware do |chain|
      chain.add ::Raven::Sidekiq
    end
  end
else
  Sidekiq.configure_server do |config|
    config.error_handlers << Proc.new {|ex,context| Raven.capture_exception(ex, :extra => {:sidekiq => context}) }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sentry-raven-0.12.2 lib/raven/integrations/sidekiq.rb
sentry-raven-0.12.1 lib/raven/integrations/sidekiq.rb