0
votes

1 - While working on a POC for sleuth, we gathered that if an incoming request to a slueth enabled application has trace/span and parent ids, they are propagated forward and new ids are not generated. However, this seems to work only when ALL 3 are present. We tried with just trace id in request headers and a new trace id was generated by sleuth - Please confirm if all 3 need to be present for successful propagation.

2 - We have multiple micro-services that talk to each other. Some of them are invoked directly from the UI layer and some others from non-sleuth applications. In both these cases, a 128 bit UUID is sent as trace id in the request. If we want to use sleuth, we would need to generate sleuth compatible 64 bit ids from the UI layer and from non sleuth apps so that they can be successfully carried over during request execution through multiple sleuth enabled apps. Can you please advice on how we can implement the 64 bit id generation so they it is compliant with sleuth standards and is propagated successfully. What are the requirements of a valid sleuth id?

Any pointers would be highly appreciated.

Thanks in advance.

2

2 Answers

1
votes
  1. A sleuth enabled app only looks for the value of header named x-b3-trace-id in the http request headers. This value is passed by the requesting app and reused by the called sleuth enabled app for its traceId. Nothing else is needed. Also keep in mind that by default, traceId and spanId are equal for all the log entries.

  2. Answer to this question is also in #1 above. If you have x-b3-trace-id embedded in the request header, that is basically what sleuth would care about for it's trace id.

I hope this helps

0
votes

You don't need to specify neither of them in to work. The span is a set of work that is done and the trace id is the correlation between all small works that are done. For example:


  1. You have service A and service B both with spring sleuth enabled.
  2. Call to service A is made via http without providing x-b3-trace-id and x-b3-span-id. New traceId and spanId will be generated.
  3. Service A is making an http call to service B it will automatically send the traceId to service B. Logging in both services will give you the same traceId which can be used to correlate all calls/events between your services and different spanIds witch can be used to build a tree of all your calls.