Sha256: dcf4761df58a8c96257c4bad4b0af8c04afa7001860c4020e143ad2e91709827

Contents?: true

Size: 671 Bytes

Versions: 9

Compression:

Stored size: 671 Bytes

Contents

require 'time'
require 'sidekiq'

module Raven
  class Sidekiq
    def call(_worker, msg, _queue)
      started_at = Time.now
      yield
    rescue Exception => 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

9 entries across 9 versions & 1 rubygems

Version Path
sentry-raven-0.15.2 lib/raven/integrations/sidekiq.rb
sentry-raven-0.15.1 lib/raven/integrations/sidekiq.rb
sentry-raven-0.15.0 lib/raven/integrations/sidekiq.rb
sentry-raven-0.14.0 lib/raven/integrations/sidekiq.rb
sentry-raven-0.13.3 lib/raven/integrations/sidekiq.rb
sentry-raven-0.13.2 lib/raven/integrations/sidekiq.rb
sentry-raven-0.13.1 lib/raven/integrations/sidekiq.rb
sentry-raven-0.13.0 lib/raven/integrations/sidekiq.rb
sentry-raven-0.12.3 lib/raven/integrations/sidekiq.rb