WeiAnHsieh
WeiAnHsieh

Reputation: 125

gRPC stream per request validation

I'm facing an issue while using gRPC with NGINX. I have a gRPC server set as an upstream for NGINX. When a client opens a bi-directional stream, it sends a request to NGINX, which then forwards the request to the upstream server. However, I'm unsure whether it's necessary to validate each request within the stream. How can I determine if every gRPC stream request is validated?

The nginx access.log only show the rpc stream but not for each small request send to the stream.

{"timestamp":"2023-12-07T03:37:12+00:00","client":"127.0.0.1","uri":"/example.Greeter/SayHello","http-status":200,"grpc-status":0,"upstream":"127.0.0.1:50051""rx-bytes":20,"tx-bytes":127}
{"timestamp":"2023-12-07T03:37:12+00:00","client":"127.0.0.1","uri":"/example.Greeter/SayHello","http-status":200,"grpc-status":0,"upstream":"127.0.0.1:50051""rx-bytes":20,"tx-bytes":127}
{"timestamp":"2023-12-07T03:37:12+00:00","client":"127.0.0.1","uri":"/example.Greeter/SayHello","http-status":200,"grpc-status":0,"upstream":"127.0.0.1:50051""rx-bytes":20,"tx-bytes":127}
{"timestamp":"2023-12-07T03:37:16+00:00","client":"127.0.0.1","uri":"/example.Greeter/StreamHello","http-status":200,"grpc-status":,"upstream":"127.0.0.1:50051""rx-bytes":65,"tx-bytes":150}

But in the console

Response from server: Hello, Alice
Response from server: Hello, Alice
Response from server: Hello, Alice
message:"Hello, Alice"
message:"Hello, Alice"
message:"Hello, Alice"

In the stream, I send three Hello in row to server and server calls send to client like a Ping-Pong

What I expect is that for each request sent from client(even from stream) should have a log to record.

Upvotes: 2

Views: 297

Answers (1)

Larry Safran
Larry Safran

Reputation: 177

The stream is an unbroken TCP stream, so you would only expect one entry. Please see the grpc.io conversation for a detailed discussion on this.

Upvotes: 0

Related Questions