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 <spenc...@google.com > <javascript:>> 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 <an...@malloc64.com >> <javascript:>> 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 grpc-io+u...@googlegroups.com <javascript:>. >>> To post to this group, send email to grp...@googlegroups.com >>> <javascript:>. >>> 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 grpc-io+unsubscr...@googlegroups.com. To post to this group, send email to grpc-io@googlegroups.com. 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/1560f0b6-a4b9-412d-bf2c-d78e5c8086fe%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.