Search code examples
springspring-cloud-sleuth

spring-cloud-sleuth services integration with 3rd party services


I have a couple of microservices: A and B. A calls B, B calls some external service. A and B uses Sleuth. Sleuth defines header X-B3-TraceId and X-B3-SpanId.

So A will propagate headers to B and B to external service...

Question: does service B stores his headers till response? And if external service somehow breaks my headers and as a response I will get wrong ids in headers... what would happen? Would is be better to define my own headers to avoid such kind of collisions? What is the best way to interact with external service?


Solution

  • Question: does service B stores his headers till response? I don't really follow but I assume that the question is that if the response comes back and some additional processing takes place, whether the tracing information will be kept. The answer is yes, it will be propagated.

    And if external service somehow breaks my headers and as a response I will get wrong ids in headers... what would happen?

    The response headers are not important to us. The request ones contain all the tracing information. The external service will not be seen inside your system cause you will not get the SR and SS annotations from their side to your Zipkin instance. So after sending them a request you will obviously not know what happens on their side.

    Would is be better to define my own headers to avoid such kind of collisions? What is the best way to interact with external service?

    I guess I've managed to respond to it by explaining that request headers are important, not response.