6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/istox/helpers/xray/grpc_server_xray_interceptor.rb', line 6
def call
meta = request.active_call.metadata
trace_id = (meta['xray_trace_id'] if meta.present? && meta.key?('xray_trace_id'))
parent_id = (meta['xray_parent_id'] if meta.present? && meta.key?('xray_parent_id'))
Thread.current[:tracer_id] = trace_id
XRay.recorder.begin_segment("#{::Istox::Xray::XrayInitializer.service_name}.grpc.#{request.method_key}",
trace_id: trace_id, parent_id: parent_id)
result = yield
XRay.recorder.end_segment
result
rescue StandardError => e
log.error e
raise e
end
|