Sha256: 546cf633a03fd55ec9a218b5710adb36be57f3fa8731ab91a25486112d3c68c9

Contents?: true

Size: 1.03 KB

Versions: 16

Compression:

Stored size: 1.03 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.to_hash)
          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

16 entries across 16 versions & 1 rubygems

Version Path
appsignal-0.8.6.beta.1 lib/appsignal/integrations/sidekiq.rb
appsignal-0.8.6.beta.0 lib/appsignal/integrations/sidekiq.rb
appsignal-0.8.5 lib/appsignal/integrations/sidekiq.rb
appsignal-0.8.4 lib/appsignal/integrations/sidekiq.rb
appsignal-0.8.4.beta.1 lib/appsignal/integrations/sidekiq.rb
appsignal-0.8.4.beta.0 lib/appsignal/integrations/sidekiq.rb
appsignal-0.8.3 lib/appsignal/integrations/sidekiq.rb
appsignal-0.8.3.beta.1 lib/appsignal/integrations/sidekiq.rb
appsignal-0.8.3.beta.0 lib/appsignal/integrations/sidekiq.rb
appsignal-0.8.2 lib/appsignal/integrations/sidekiq.rb
appsignal-0.8.1 lib/appsignal/integrations/sidekiq.rb
appsignal-0.8.1.beta.4 lib/appsignal/integrations/sidekiq.rb
appsignal-0.8.1.beta.3 lib/appsignal/integrations/sidekiq.rb
appsignal-0.8.1.beta.2 lib/appsignal/integrations/sidekiq.rb
appsignal-0.8.1.beta.1 lib/appsignal/integrations/sidekiq.rb
appsignal-0.8.1.beta.0 lib/appsignal/integrations/sidekiq.rb