67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
# File 'lib/instana/instrumentation/resque.rb', line 67
def perform(job)
kvs = {}
kvs[:'resque-worker'] = {}
begin
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
trace_context = if ::Instana.config[:'resque-client'][:propagate] && job.payload['args'][-1].is_a?(Hash) && job.payload['args'][-1].keys.include?('trace_id')
context_from_wire = job.payload['args'].pop
::Instana::SpanContext.new(
trace_id: context_from_wire['trace_id'],
span_id: context_from_wire['span_id']
)
end
span = OpenTelemetry::Trace.non_recording_span(trace_context) if trace_context
Trace.with_span(span) do
Instana.tracer.in_span(:'resque-worker', attributes: kvs) do |span|
super(job)
end
end
end
|