Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How spring cloud sleuth works?

How spring cloud sleuth works behind the scenes?. Will it be able to trace library calls also?. Im having a spring boot project A which uses library B. Any hit to endpoints in project A is traced by sleuth, but when I try to hit rest controller on Library B sleuth fails to trace the request. Is there a way to tell sleuth to trace library calls also?

like image 966
Kiki Avatar asked Oct 18 '25 14:10

Kiki


1 Answers

Spring Cloud Sleuth up till version 2.0 has its own tracer and since 2.0 it's reusing https://github.com/openzipkin/brave . A tracer is responsible for passing of the tracing context. What does it mean? It means that you have to propagate the tracing information:

  • what is the current span (span is a unit of work)
  • what is the current trace (trace is an id for all unit of works forming a single business operation)

Having the tracing information propagated in-process (between different libraries, threads etc.), and out of process (via Http headers, messaging etc.), Sleuth is able to process this information and store it locally in order to continue the trace.

You need to use the SpanInjector and SpanExtractor (prior to Sleuth 2.0) or Brave's handler mechanisms to properly handle receiving and sending of spans.

like image 105
Marcin Grzejszczak Avatar answered Oct 21 '25 04:10

Marcin Grzejszczak



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!