I would like my service consumers pass the TraceId as Header Param with name X-B3-TraceId and valid 128 bits Hex String that shall get propagated in further path down the line and indeed service will return same Sleuth Trace Id back to caller. I have used Spring Cloud Sleuth added Custom Filter and Span Extractor in order to put in in Service Response.
The Entire set up works well in my local when App is deployed in Embedded tomcat, however when same App is deployed in Bluemix then The Response does not have same Sleuth Trace Id which was passed in Request.
Is there any known such defect and workaround for this problem when Sleuth is used in IBM Bluemix Cloud Foundry ?
If it is, could you please advise how to proceed.
I have created Demo Project in following location: 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
You always need to pass tracing headers. All the X-B3 headers must be propagated to make distributed tracing work properly.