1. We generally consider a single call to be a single stream in which
messages and metadata are sent both from the client to the server and from
the server to the client. In general, requests and responses can be
separated in time, and there can even be back-and-forth interactions in a
single stream before a call ends, but in the case of a unary call in
particular, the end user sees the incoming metadata as one event, and the
rest of the response as another single event. The interceptor API makes no
distinction between unary and streaming requests, so it always sees those
events separately.

2. The client interceptors proposal you linked has examples of creating and
using interceptors. If that doesn't have what you are looking for you will
have to be more specific.

3. The client considers a call completed when it receives the status
information in the HTTP2 trailers from the server, or the stream is closed
some other way. If a client makes a call and never sees it end that way,
and the call has a deadline configured, it will create a DEADLINE_EXCEEDED
status at that configured deadline. All interceptors and the end user will
see that status. If the network connection drops and the client detects it,
the call can also end with an UNAVAILABLE status.

4. If a unary request never receives a response message, it should
eventually end with a non-OK status, so an interceptor can detect that just
by seeing that it has received a status and not a message.

On Thu, Jan 11, 2024 at 6:43 PM R L <rachel.yuqiu...@gmail.com> wrote:

> Hi friends, and well wishes to anyone reading this post.
>
> I'm currently working to instrument some kind of logging / tracing on the
> client side for our GRPC requests.
>
> I've been reading this proposal
> <https://github.com/grpc/proposal/blob/master/L5-node-client-interceptors.md>
> and would like to level set some of my understandings so far.
>
> So first--  the nature of a *client unary interceptor*, as I understand
> it, is that we can add modifications such as injecting client metadata
> before the request is sent to the server.
>
> The proposal mentions such things as "inbound" and "outbound" operations.
>
> *Question 1*: When a GRPC call is being made, are there two streams being
> opened? Outbound being the stream opened because of the request sent BY the
> client, and Inbound being the stream opened to *return* the result by the
> server?
>
> So, the listener methods such as `onReceiveMetadata(metadata, next)` are
> "inbound" in that sense? And it is correct to say that by the time we
> receive these inbound operations, whatever processing that is done within
> the function call is "done", and we are just intercepting the entirety of
> the response as it comes in?
>
> *Question 2:* At the time of a call being made by the client, we can pass
> in interceptors like so:
> ```
> client.myCall(message, { interceptors: [interceptor] });
> ```
> Is there a practical example for how someone might want to pass in a list
> of interceptors when a call is made?
>
> *Question 3:* In a scenario where the client thinks it sent a message,
> but the server never receives / acknowledges the request, what happens?
> (Maybe network went down because of network gremlins), would the pipe close
> with a stream timeout of `DEADLINE_EXCEEDED` error code?
>
> *Question 4:* Similar to this question,
> <https://github.com/grpc/grpc-go/issues/3492> in the scenario where the
> stream is not closed but the message is never received by the client- a way
> to "triage" this would be to add timers earlier in the interceptor stack,
> and see that the listener method "onRecieveMessage()" for example, was
> never called.
>
> Feedback, pointers, and links towards any extra reading would all be
> appreciated!
>
> Thanks,
> Rachel
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups "
> grpc.io" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to grpc-io+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/grpc-io/f739dff2-c37d-478a-a499-ff79a8640c05n%40googlegroups.com
> <https://groups.google.com/d/msgid/grpc-io/f739dff2-c37d-478a-a499-ff79a8640c05n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to grpc-io+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/CAPK2-4fcbUAnfRqsuwhOse_4d3%3DMmzbbGk6rY04kb50JhKj0rQ%40mail.gmail.com.

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to