Published a cleaned out version of these interceptors at - https://github.com/ankurcha/linkerd-grpc-interceptors
On Sunday, July 30, 2017 at 12:42:37 AM UTC-7, Ankur Chauhan wrote: > > Thanks for the code example Spencer. This is exactly what I needed. I'll > make it into a library and publish it for others to enjoy once i test it a > little bit. > > On Friday, July 28, 2017 at 10:41:34 AM UTC-7, Spencer Fang wrote: >> >> In gist form for easier mailing list archival, because I'd probably clean >> up that branch at some point: >> https://gist.github.com/zpencer/e581ae1b55974427512d1ad8f157e323 >> >> On Fri, Jul 28, 2017 at 10:28 AM, Spencer Fang <[email protected]> >> wrote: >> >>> Hello Ankur, >>> The io.grpc.Context is indeed the right thing to use here. What you want >>> to do is to first create a ServerInterceptor that looks at the incoming >>> headers and pulls out all "l5d-" prefixed keys. The ServerCall.Listener is >>> how your application defines how to respond to incoming requests, so the >>> interceptor must make sure that a io.grpc.Context containing the "l5d-" >>> info is present whenever your code runs. Next, you need a ClientInterceptor >>> that looks at the current io.grpc.Context, and merges "l5d-" headers into >>> any outgoing headers. >>> >>> I have created a branch on github that shows what I mean: >>> https://github.com/grpc/grpc-java/compare/master...zpencer:grpc-io-l5d-demo?expand=1 >>> >>> >>> >>> On Thu, Jul 27, 2017 at 9:01 PM, Ankur Chauhan <[email protected]> >>> wrote: >>> >>>> Hi, >>>> >>>> I am trying to integrate some of our grpc services with linkerd ( a >>>> service mesh ). As a part of doing that, the recommendation is that the >>>> apps should propagate any headers with "l5d-" prefix to all downstream >>>> services. I tried looking at some tests for io.grpc.Context but can't >>>> figure out what would be the best way to do this. Anyone care to comment? >>>> This should be similar to how deadlines are propagated (i think). >>>> >>>> -- Ankur >>>> >>>> -- >>>> 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/19357e59-34d8-461a-997e-287cac9f096b%40googlegroups.com >>>> >>>> <https://groups.google.com/d/msgid/grpc-io/19357e59-34d8-461a-997e-287cac9f096b%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >>> >>> >>> -- >>> Spencer Fang >>> >> >> >> >> -- >> Spencer Fang >> > -- 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/6c2c9790-2ac0-442b-a3e7-1904cc62679f%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
