Sha256: ba614071351bfd3d23b0400259d3405a39bf2b796ffe6fd6897acac0d3ba7b44

Contents?: true

Size: 828 Bytes

Versions: 7

Compression:

Stored size: 828 Bytes

Contents

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

  module Appsignal
    module Integrations
      module ResquePlugin
        def around_perform_resque_plugin(*args)
          Appsignal.monitor_transaction(
            'perform_job.resque',
            :class => self.to_s,
            :method => 'perform'
          ) do
            yield
          end
        end
      end
    end
  end

  # Set up IPC
  Resque.before_first_fork do
    Appsignal::IPC::Server.start if Appsignal.active?
  end

  # In the fork, stop the normal agent startup
  # and stop listening to the server
  Resque.after_fork do |job|
    Appsignal::IPC.forked! if Appsignal.active?
  end

  # Extend the default job class with AppSignal instrumentation
  Resque::Job.send(:extend, Appsignal::Integrations::ResquePlugin)
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
appsignal-0.11.17 lib/appsignal/integrations/resque.rb
appsignal-0.11.16 lib/appsignal/integrations/resque.rb
appsignal-0.11.15 lib/appsignal/integrations/resque.rb
appsignal-0.11.14 lib/appsignal/integrations/resque.rb
appsignal-0.11.14.beta.1 lib/appsignal/integrations/resque.rb
appsignal-0.11.13 lib/appsignal/integrations/resque.rb
appsignal-0.11.13.beta.4 lib/appsignal/integrations/resque.rb