Passing trace id from spring web app(using cloud sleuth) to non spring web application when hitting an api
I have two services A and B
A : it is written in spring boot
B: it is web app written in java with custom framework
I want to pass trace id generated by Spring cloud Sleuth whe开发者_C百科n calling api from A to B and then want to use it in logging in B .
IF B is also written in Spring Boot then Spring cloud Sleuth given this out of box
What is best way to achieve this ?
If you use RestTemplate or WebClient the trace information will be sent to B.
The headers are:
- x-b3-traceid
- x-b3-spanid
- x-b3-parentspanid
So you'll have to get these headers with a Filter in B and then you can for example write them to the Loggers MDC.
精彩评论