Sha256: eb3f36f857ede804e870a5632691c673e02d2e4af9852422679821aa4874ed43

Contents?: true

Size: 617 Bytes

Versions: 5

Compression:

Stored size: 617 Bytes

Contents

require 'time'

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, context) }
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
sentry-raven-0.9.4 lib/raven/sidekiq.rb
sentry-raven-0.9.3 lib/raven/sidekiq.rb
sentry-raven-0.9.2 lib/raven/sidekiq.rb
sentry-raven-0.9.1 lib/raven/sidekiq.rb
sentry-raven-0.9.0 lib/raven/sidekiq.rb