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
|
# File 'lib/istox/helpers/xray/rabbitmq_publisher_interceptor.rb', line 6
def call(message, options)
no_segment = false
begin
no_segment = XRay.recorder.current_segment.blank?
rescue XRay::ContextMissingError
no_segment = true
end
XRay.recorder.begin_segment('rabbitmq_publish') if no_segment
XRay.recorder.begin_subsegment("rabbitmq_publish.#{options[:routing_key]}")
message[:xray_trace_id] = XRay.recorder.current_segment.trace_id
message[:xray_parent_id] = XRay.recorder.current_segment.id
Thread.current[:tracer_id] = XRay.recorder.current_segment.trace_id
XRay.recorder.end_subsegment
XRay.recorder.end_segment if no_segment
rescue StandardError => e
log.error e
raise e
end
|