On Thu, Nov 10, 2016 at 2:28 PM, <[email protected]> wrote:

> Hi,
>
> I'm implementing a StreamServerInterceptor.
>
> func StreamServerInterceptor(srv interface{}, ss grpc.ServerStream, info
> *grpc.StreamServerInfo, handler grpc.StreamHandler) error {
>     // do some stuff, like attach a tracer to the context
>     return handler(srv, ss)
> }
>
> I can read the inbound ctx from ss.Context() but I can't figure out a way
> to replace it on the stream with a derivative Context. The best I can thing
> of is to wrap ss with some other grpc.ServerStream that does what I want.
> Is this the canonical way to do this?
>
Yes you can do that. And we recently add
https://github.com/grpc/grpc-go/blob/master/tap/tap.go and you can also use
that attach your stuff onto the context in the very early stage (so that
ss.Context() gets the ctx you expect). But keep in mind they are still
EXPERIMENTAL and might be subject to change later.

>
> Thanks,
>
> -Franco
>
> --
> 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 [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/grpc-io.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/grpc-io/7146f65d-254d-4dbc-9d04-44e385e6e9d3%40googlegroups.com
> <https://groups.google.com/d/msgid/grpc-io/7146f65d-254d-4dbc-9d04-44e385e6e9d3%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Thanks,
-Qi

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/CAFnDmdrAL12nu4XfZSLTEx2V9W2n9FD2mBE0B6U69F%2BYRK0ROA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

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

Reply via email to