Sha256: 5413c268b1b980873ff24fa6f94e1796e7e04898cc81aaf982d99a9c6b68d837

Contents?: true

Size: 1.02 KB

Versions: 10

Compression:

Stored size: 1.02 KB

Contents

if defined?(::Sidekiq)
  Appsignal.logger.info('Loading Sidekiq integration')

  module Appsignal
    module Integrations
      class SidekiqPlugin
        def call(worker, item, queue)
          Appsignal::Transaction.create(SecureRandom.uuid, ENV)
          ActiveSupport::Notifications.instrument(
            'perform_job.sidekiq',
            :class => item['class'],
            :method => 'perform',
            :attempts => item['retry_count'],
            :queue => item['queue'],
            :queue_start => item['enqueued_at']
          ) do
            yield
          end
        rescue Exception => exception
          unless Appsignal.is_ignored_exception?(exception)
            Appsignal::Transaction.current.add_exception(exception)
          end
          raise exception
        ensure
          Appsignal::Transaction.current.complete!
        end
      end
    end
  end

  Sidekiq.configure_server do |config|
    config.server_middleware do |chain|
      chain.add Appsignal::Integrations::SidekiqPlugin
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
appsignal-0.8.15 lib/appsignal/integrations/sidekiq.rb
appsignal-0.8.14 lib/appsignal/integrations/sidekiq.rb
appsignal-0.8.13 lib/appsignal/integrations/sidekiq.rb
appsignal-0.8.12 lib/appsignal/integrations/sidekiq.rb
appsignal-0.8.11 lib/appsignal/integrations/sidekiq.rb
appsignal-0.8.10 lib/appsignal/integrations/sidekiq.rb
appsignal-0.8.8 lib/appsignal/integrations/sidekiq.rb
appsignal-0.8.7 lib/appsignal/integrations/sidekiq.rb
appsignal-0.8.7.alpha.1 lib/appsignal/integrations/sidekiq.rb
appsignal-0.8.6 lib/appsignal/integrations/sidekiq.rb