We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
client中使用了如下的代码
// gin mw func InitReq(c *gin.Context) { ... rpcctx := metainfo.WithPersistentValue(context.Background(), "logid", logid) c.Set("rpcctx", rpcctx) ... }
func GetRpcCtx(c *gin.Context) context.Context { res, _ := c.Get("rpcctx") return res.(context.Context) } func RpcTestHandler(c *gin.Context) { ...... c1 := GetRpcCtx(c) fmt.Println(metainfo.GetPersistentValue(c1, "logid")) // 可以获取到存入的值 resp, err := rpc.XXXX.Pingpong(c1, xxx.NewPingPongRequest()) ..... }
rpc server mw代码,中间件无法获取到上游gin服务中的PersistentValue
func ImportLinkMW(next endpoint.Endpoint) endpoint.Endpoint { return func(ctx context.Context, request, response interface{}) error { // ok: false logid, ok := metainfo.GetPersistentValue(ctx, "logid") fmt.Println(metainfo.GetPersistentValue(ctx, "logid")) if !ok || logid == "" { ctx = metainfo.WithPersistentValue(ctx, "logid", "12345") } fmt.Println(logid) err := next(ctx, request, response) return err } }
编码使用thrift,传输协议未修改,请问一下数据没有传到下游是因为context的问题还是有什么其他的配置,
The text was updated successfully, but these errors were encountered:
客户端默认的协议不支持传递元信息。你需要增加一个 option:
client.WithTransportProtocol(transport.TTHeaderFramed),
Sorry, something went wrong.
No branches or pull requests
client中使用了如下的代码
rpc server mw代码,中间件无法获取到上游gin服务中的PersistentValue
编码使用thrift,传输协议未修改,请问一下数据没有传到下游是因为context的问题还是有什么其他的配置,
The text was updated successfully, but these errors were encountered: