6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/instana/instrumentation/bunny.rb', line 6
def publish(payload, options = {})
if ::Instana.tracer.tracing?
exchange_name = name.empty? ? 'default' : name
routing_key = options[:routing_key] || ''
kvs = {
rabbitmq: {
sort: 'publish',
address: channel.connection.host,
key: routing_key,
exchange: exchange_name
}
}
::Instana.tracer.in_span(:rabbitmq, attributes: kvs) do |span|
options[:headers] ||= {}
options[:headers]['X-Instana-T'] = span.context.trace_id
options[:headers]['X-Instana-S'] = span.context.span_id
options[:headers]['X-Instana-L'] = span.context.level.to_s
super(payload, options)
end
else
super(payload, options)
end
rescue => e
::Instana.logger.debug { "#{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}" }
raise
end
|