Class: GrpcInterceptors::Client::OpenTelemetryTracingInterceptor

Inherits:
GRPC::ClientInterceptor
  • Object
show all
Defined in:
lib/grpc_interceptors/client/opentelemetry_tracing_interceptor.rb

Instance Method Summary collapse

Instance Method Details

#request_response(request: nil, call: nil, method: nil, metadata: nil) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/grpc_interceptors/client/opentelemetry_tracing_interceptor.rb', line 9

def request_response(request: nil, call: nil, method: nil, metadata: nil)
  attributes = Common::OpenTelemetryHelper.tracing_attributes(method)

  Common::OpenTelemetryHelper.tracer.in_span(
    method, kind: KIND, attributes: attributes
  ) do
    OpenTelemetry.propagation.inject()
    yield
  end
end

#server_streamer(request: nil, call: nil, method: nil, metadata: nil) ⇒ Object

def client_streamer(_requests: nil, call: nil, method: nil, metadata: nil)

yield

end



24
25
26
27
28
29
30
31
32
33
# File 'lib/grpc_interceptors/client/opentelemetry_tracing_interceptor.rb', line 24

def server_streamer(request: nil, call: nil, method: nil, metadata: nil)
  attributes = Common::OpenTelemetryHelper.tracing_attributes(method)

  Common::OpenTelemetryHelper.tracer.in_span(
    method, kind: KIND, attributes: attributes
  ) do
    OpenTelemetry.propagation.inject()
    yield
  end
end