Class: Griffin::Interceptors::Server::PayloadInterceptor
- Inherits:
-
GRPC::ServerInterceptor
- Object
- GRPC::ServerInterceptor
- Griffin::Interceptors::Server::PayloadInterceptor
show all
- Defined in:
- lib/griffin/interceptors/server/payload_interceptor.rb
Instance Method Summary
collapse
Instance Method Details
#request_response(request: nil, call: nil) ⇒ Object
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/griffin/interceptors/server/payload_interceptor.rb', line 9
def request_response(request: nil, call: nil, **)
logs = {}
if call.metadata['x-request-id']
logs['grpc.x_request_id'] = call.metadata['x-request-id']
end
GRPC.logger.info(logs.merge('grpc.request.content' => (request)))
yield.tap do |resp|
logs['grpc.response.content'] = (resp)
GRPC.logger.info(logs)
end
end
|
#server_streamer(call: nil) {|Griffin::Interceptors::Server::PayloadStreamer.new(call, GRPC.logger, logs)| ... } ⇒ Object
Also known as:
client_streamer, bidi_streamer
24
25
26
27
28
29
30
31
32
|
# File 'lib/griffin/interceptors/server/payload_interceptor.rb', line 24
def server_streamer(call: nil, **)
logs = {}
if call.metadata['x-request-id']
logs['grpc.x_request_id'] = call.metadata['x-request-id']
end
yield(Griffin::Interceptors::Server::PayloadStreamer.new(call, GRPC.logger, logs))
end
|