Sha256: 83a4e7bd4770cdb788cb974f4627c0c7727e19bf4b0268e4eaf41e28044bc641

Contents?: true

Size: 949 Bytes

Versions: 9

Compression:

Stored size: 949 Bytes

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
          Appsignal.add_exception(exception)
          raise exception
        ensure
          Appsignal::Transaction.complete_current!
        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

9 entries across 9 versions & 1 rubygems

Version Path
appsignal-0.9.6 lib/appsignal/integrations/sidekiq.rb
appsignal-0.9.5 lib/appsignal/integrations/sidekiq.rb
appsignal-0.9.4 lib/appsignal/integrations/sidekiq.rb
appsignal-0.9.3 lib/appsignal/integrations/sidekiq.rb
appsignal-0.9.2 lib/appsignal/integrations/sidekiq.rb
appsignal-0.9.1 lib/appsignal/integrations/sidekiq.rb
appsignal-0.9.0 lib/appsignal/integrations/sidekiq.rb
appsignal-0.9.0.beta.1 lib/appsignal/integrations/sidekiq.rb
appsignal-0.9.0.alpha.1 lib/appsignal/integrations/sidekiq.rb