lib/instana/instrumentation/resque.rb in instana-1.203.0 vs lib/instana/instrumentation/resque.rb in instana-1.203.1
- old
+ new
@@ -26,11 +26,11 @@
def enqueue(klass, *args)
if Instana.tracer.tracing?
kvs = collect_kvs(:enqueue, klass, args)
Instana.tracer.trace(:'resque-client', kvs) do
- args.push(::Instana.tracer.context.to_hash)
+ args.push(::Instana.tracer.context.to_hash) if ::Instana.config[:'resque-client'][:propagate]
super(klass, *args)
end
else
super(klass, *args)
end
@@ -40,11 +40,11 @@
if Instana.tracer.tracing? && !Instana.tracer.tracing_span?(:'resque-client')
kvs = collect_kvs(:enqueue_to, klass, args)
kvs[:Queue] = queue.to_s if queue
Instana.tracer.trace(:'resque-client', kvs) do
- args.push(::Instana.tracer.context.to_hash)
+ args.push(::Instana.tracer.context.to_hash) if ::Instana.config[:'resque-client'][:propagate]
super(queue, klass, *args)
end
else
super(queue, klass, *args)
end
@@ -76,10 +76,10 @@
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 job.payload['args'][-1].is_a?(Hash) && job.payload['args'][-1].keys.include?('trace_id')
+ 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(
context_from_wire['trace_id'],
context_from_wire['span_id']
)