You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 27, 2023. It is now read-only.
现象:增加了kratos的tracing中间件后,在gin.Context中获取不到traceid。
示例代码:
请求示例:
原因:
kratos中间件在调用next函数时,接收context为参数并传递给下一个next处理。
tracing.Server()
中间件使用WithValue
方法延长了context链。在原生kratos中,context是传递的,这没有问题。但gin里总是使用gin.Conetxt。在gin.Context链之上的上下文都无法检索到。
因此需要在kratos中间件处理完成时,将最后的context重新绑定到gin.Request上。
The text was updated successfully, but these errors were encountered: