10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/grpc_interceptors/server/opentelemetry_tracing_instrument.rb', line 10
def request_response(request: nil, call: nil, method: nil, &block)
context = OpenTelemetry.propagation.(call.metadata)
route_name = Common::GrpcHelper.route_name(method)
attributes = Common::OpenTelemetryHelper.tracing_attributes(method)
kind = OpenTelemetry::Trace::SpanKind::SERVER
OpenTelemetry::Context.with_current(context) do
Common::OpenTelemetryHelper.tracer.in_span(
route_name,
attributes: attributes,
kind: kind,
&block
)
end
end
|