Slide 49
Slide 49 text
©2020 Wantedly, Inc.
func ContextPropagationInterceptor() func(ctx context.Context, method string, req, r
return func(ctx context.Context, method string, req, reply interface{}, cc *grpc.C
md, _ := metadata.FromIncomingContext(ctx)
for key, values := range md {
if !isKeyToPropagate(key) {
continue
}
for _, v := range values {
ctx = metadata.AppendToOutgoingContext(ctx, key, v)
}
}
return invoker(ctx, method, req, reply, cc, opts...)
}
}
ϔομൖ - Golang
Golang Ͱ gRPC Λલఏʹ͍ͯ͠ΔͷͰ ctx ʹೖ͍ͬͯΔ
Outgoing ͳ request ʹ༩͢Δ͚ͩ