Sha256: bc9bf5a6372a497b8f489c2db611cb69a34d81868259a8c88315c0e4b0b0cd33

Contents?: true

Size: 856 Bytes

Versions: 45

Compression:

Stored size: 856 Bytes

Contents

# (c) Copyright IBM Corp. 2021
# (c) Copyright Instana Inc. 2021

module Instana
  module Activators
    class ResqueWorker < Activator
      def can_instrument?
        defined?(::Resque::Worker) &&
          defined?(::Resque::Job) &&
          ::Instana.config[:'resque-worker'][:enabled]
      end

      def instrument
        require 'instana/instrumentation/resque'

        ::Resque::Worker.prepend(::Instana::Instrumentation::ResqueWorker)
        ::Resque::Job.prepend(::Instana::Instrumentation::ResqueJob)

        if ::Instana.config[:'resque-worker'][:'setup-fork']
          ::Resque.after_fork do |_job|
            ::Instana.agent.after_fork
          end
        end

        # Set this so we assure that any remaining collected traces are reported at_exit
        ENV['RUN_AT_EXIT_HOOKS'] = "1"

        true
      end
    end
  end
end

Version data entries

45 entries across 45 versions & 1 rubygems

Version Path
instana-1.217.1 lib/instana/activators/resque_worker.rb
instana-1.217.0 lib/instana/activators/resque_worker.rb
instana-1.216.0 lib/instana/activators/resque_worker.rb
instana-1.215.1 lib/instana/activators/resque_worker.rb
instana-1.215.0 lib/instana/activators/resque_worker.rb
instana-1.214.4 lib/instana/activators/resque_worker.rb
instana-1.214.3 lib/instana/activators/resque_worker.rb
instana-1.214.2 lib/instana/activators/resque_worker.rb
instana-1.214.1 lib/instana/activators/resque_worker.rb
instana-1.214.0 lib/instana/activators/resque_worker.rb
instana-1.213.3 lib/instana/activators/resque_worker.rb
instana-1.213.2 lib/instana/activators/resque_worker.rb
instana-1.213.1 lib/instana/activators/resque_worker.rb
instana-1.213.0 lib/instana/activators/resque_worker.rb
instana-1.212.0 lib/instana/activators/resque_worker.rb
instana-1.211.0 lib/instana/activators/resque_worker.rb
instana-1.210.1 lib/instana/activators/resque_worker.rb
instana-1.210.0 lib/instana/activators/resque_worker.rb
instana-1.209.8 lib/instana/activators/resque_worker.rb
instana-1.209.7 lib/instana/activators/resque_worker.rb