Module: Instana::Instrumentation::ResqueWorker

Defined in:
lib/instana/instrumentation/resque.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



65
66
67
# File 'lib/instana/instrumentation/resque.rb', line 65

def self.included(klass)
  ::Instana::Util.method_alias(klass, :perform)
end

Instance Method Details

#perform_with_instana(job) ⇒ Object



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/instana/instrumentation/resque.rb', line 69

def perform_with_instana(job)
  kvs = {}
  kvs[:'resque-worker'] = {}

  begin
    if ENV.key?('INSTANA_SERVICE_NAME')
      kvs[:service] = ENV['INSTANA_SERVICE_NAME']
    end
    kvs[:'resque-worker'][:job] = job.payload['class'].to_s
    kvs[:'resque-worker'][:queue] = job.queue
  rescue => e
    ::Instana.logger.debug { "#{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}" } if Instana::Config[:verbose]
  end

  Instana.tracer.start_or_continue_trace(:'resque-worker', kvs) do
    perform_without_instana(job)
  end
end