我希望我的服务消费者将 TraceId 作为标题参数传递,名称为 X-B3-TraceId 和有效的 128 位十六进制字符串,该字符串将在进一步的路径中向下传播,并且确实服务会将相同的 Sleuth Trace Id 返回给调用者。我使用 Spring Cloud Sleuth 添加了自定义过滤器和跨度提取器以放入服务响应中。
当应用程序部署在嵌入式 tomcat 中时,整个设置在我的本地运行良好,但是当相同的应用程序部署在 Bluemix 中时,响应没有在请求中传递的相同 Sleuth Trace Id。
在 IBM Bluemix Cloud Foundry 中使用 Sleuth 时,是否有任何已知的此类缺陷和解决此问题的方法?
如果是,请您建议如何进行。
我在以下位置创建了演示项目:https ://github.com/imram/sleuthHeaderIssue
Please Run the Micro Service locally.
URL: localhost:9090/hello?name=Ram
Header:
X-B3-TraceId:d61436368bae3c12ce5f844337f3ee52
Service will return:
HELLORam
Header:
Content-Length →8
Content-Type →text/plain;charset=UTF-8
Date →Thu, 11 Jan 2018 01:38:48 GMT
X-Application-Context →application:9090
X-B3-TraceId →d61436368bae3c12ce5f844337f3ee52
Note Trace Id is same in RQ and RS.
Deploy Same Service in IBM Bluemix:
URL: https://sleuth-header-demo.mybluemix.net/hello?name=Ram .
Header
X-B3-TraceId:d61436368bae3c12ce5f844337f3ee52
Response:
HELLORam
Header:
Connection →Keep-Alive
Content-Type →text/plain;charset=UTF-8
Date →Thu, 11 Jan 2018 01:38:30 GMT
Transfer-Encoding →chunked
X-Application-Context →sleuth-header-demo:bluemix:0
X-B3-Traceid →b896d05d9f0ae105
X-Backside-Transport →OK OK
X-Global-Transaction-ID →2714561407
See the Trace Id(X-B3-Traceid) got ignore what was present in
Request and got Regenerated as b896d05d9f0ae105