0

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?

Pavel
  • 653
  • 2
  • 11
  • 31

1 Answers1

1

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.

Marcin Grzejszczak
  • 10,624
  • 1
  • 16
  • 32
  • Thanks for response, seems that I've got the idea. – Pavel Oct 23 '17 at 11:28
  • Marcin, we came out with another question: We have client (non Spring) - it calls my service A. Than client calls my another service C. I want to trace both calls under same id (don't need to be trace id). Also if it would be nice if this id were generated on first call of service A. So what is the best way to do this? – Pavel Oct 23 '17 at 11:46
  • Use https://github.com/openzipkin/brave for A, Brave or Sleuth for B and Brave or Sleuth for C. That way everything will get propagated properly since Sleuth and Brave work fine together. – Marcin Grzejszczak Oct 23 '17 at 12:11
  • Thanks, will take a look! – Pavel Oct 23 '17 at 12:13