Sha256: eedc6e9abcde1d92bcc438ebaa4ff7df56d6b8ae3b5dfeeaa6f6ba7cc2e33650

Contents?: true

Size: 641 Bytes

Versions: 5

Compression:

Stored size: 641 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, :extra => {:sidekiq => context}) }
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
sentry-raven-0.12.0 lib/raven/sidekiq.rb
mustwin-sentry-raven-0.11.2 lib/raven/sidekiq.rb
sentry-raven-0.11.2 lib/raven/sidekiq.rb
sentry-raven-0.11.1 lib/raven/sidekiq.rb
sentry-raven-0.10.1 lib/raven/sidekiq.rb