Questions tagged [spring-cloud-sleuth]

Spring Cloud Sleuth implements a distributed tracing solution for Spring Cloud, borrowing heavily from Dapper, Zipkin and HTrace.

For most users, Sleuth should be invisible, and all your interactions with external systems should be instrumented automatically. You can capture data simply in logs, or by sending it to a remote collector service.

A Span is the basic unit of work. For example, sending RPC is a new span, as is sending a response to an RPC. Span’s are identified by a unique 64-bit ID for the span and another 64-bit ID for the trace the span is a part of. Spans also have other data, such as descriptions, key-value annotations, the ID of the span that caused them, and process ID’s (normally IP address). Spans are started and stopped, and they keep track of their timing information. Once you create a span, you must stop it at some point in the future. A set of spans forming a tree-like structure called a Trace. For example, if you are running a distributed big-data store, a trace might be formed by a put request.

Spring Cloud Sleuth features:

  • Adds trace and span ids to the Slf4J MDC, so you can extract all the logs from a given trace or span in a log aggregator.

  • Provides an abstraction over common distributed tracing data models: traces, spans (forming a DAG), annotations, key-value annotations. Loosely based on HTrace, but Zipkin (Dapper) compatible.

  • Instruments common ingress and egress points from Spring applications (servlet filter, rest template, scheduled actions, message channels, zuul filters, feign client).

  • If spring-cloud-sleuth-zipkin is available then the app will generate and collect Zipkin-compatible traces via HTTP. By default, it sends them to a Zipkin collector service on localhost (port 9411). Configure the location of the service using spring.zipkin.baseUrl.

638 questions
0
votes
1 answer

How to name Span in Spring Sleuth in a reactive calling chaining

I have Spring Cloud Sleuth (2.0.2.RELEASE) working within a (partially) reactive class in some web based request/response system. The code is something like this: private static final Scheduler PROCESSING_SCHEDULER =…
0
votes
3 answers

Setting a Span's trace id in Brave vs. Sleuth

I'm looking for the proper way to set the trace-id for a Span in Brave. Pre-Brave we had: Span span = Span.builder().traceId(someLong).build(); What's the brave equivalent? I have the following, but it's obviously not correct, as there's no way to…
blackcompe
  • 3,180
  • 16
  • 27
0
votes
0 answers

How to propagate header values with different header names using sleuth/brave

I would like to propagate the request-foo header value received in a service (foo) to another header header-bar for service (bar). I would like to leverage sleuth/brave instrumentation for this without including it into the business…
Zoltan Altfatter
  • 802
  • 2
  • 11
  • 25
0
votes
1 answer

correlationId propagated to spring sleuth 1.x

I have the following setup: Proxy (P) -- HTTP --> Spring Boot 2 app (X) -- HTTP --> Spring Boot 1 app (Y) The proxy sends the requestId as an HTTP header which I need to include in the logs of both X and Y. For the X app I could easily do it with…
Zoltan Altfatter
  • 802
  • 2
  • 11
  • 25
0
votes
1 answer

Cloud Sleuth change from SpringBoot 1.5 to 2.x

Earlier this code worked fine: @Component @RequiredArgsConstructor(onConstructor = @__(@Autowired)) class CustomTraceableExecutorServiceImpl implements ExecutorServiceProvider { @Qualifier(value = "defaultExecutorService") private final…
tryingHard
  • 1,794
  • 4
  • 35
  • 74
0
votes
1 answer

Where to find Sleuth's Span.TRACE_ID_NAME replacement after migration to spring boot 2.x?

I'm migrating my service from spring boot 1.5.2 to 2.0.5. Somewhere in the code i used the following Sleuth's constant org.springframework.cloud.sleuth.Span.TRACE_ID_NAME After migration there is no such constant and code doesn't compile. I tried…
Wojciech Wirzbicki
  • 3,887
  • 6
  • 36
  • 59
0
votes
1 answer

spring where to find implementation code of annotations

In spring and spring-boot there is a lot of "magic" that happens just by annotating methods and classes. For learning purposes and do-it-yourself stuff I would be interested to have a look at them and so wondering how to find the "magic code" that…
Dirk Hoffmann
  • 1,444
  • 17
  • 35
0
votes
2 answers

Spring cloud sleuth - Sleuth compliant Id generation for non sleuth apps

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…
user10267174
  • 51
  • 2
  • 6
0
votes
1 answer

Spring cloud sleuth how to allow certain URL pattern alone to export traces to zipkin

Requirement is to export traces for requests that matches url pattern to zipkin from apps. I got to know that there are options in sleuth properties to exclude traces from exporting. But my case is the opposite of it. Include traces for exporting…
adhithyan
  • 41
  • 6
0
votes
0 answers

Publish spans to Zipkin via Kafka using Sleuth

I have the following problem: i need to send traces to Zipkin via Kafka using Sleuth. Based on what i read in the…
Charles
  • 570
  • 11
  • 29
0
votes
1 answer

why services are not shown in zipkin?

I use Spring boot: 1.5.16 Spring cloud: Edgware.RELEASE Java: 1.8 My Sampler looks like that: @Bean public Sampler sampler(){ return new AlwaysSampler(); } In Eureka everything seems well: But my problem is that in Zipkin I can't…
grep
  • 5,465
  • 12
  • 60
  • 112
0
votes
2 answers

How to track the span through different dependencies with Sleuth?

I'm learning how to track my distributed processes through all the microservices. I've been playing with Sleuth, Zipkin and different microservices, and it works fantastic! But when I try to do the same in a project interacting between the different…
JUAN CALVOPINA M
  • 3,695
  • 2
  • 21
  • 37
0
votes
1 answer

Problem with Jaeger, logback and Sleuth working together

I was developing a Spring Boot application in which the loging is done by logback and Jaeger is integrated for instrumentation. Myservice.java @SpringBootApplication public class Myservice{ public static void main(String[] args) { …
das
  • 669
  • 2
  • 12
  • 22
0
votes
1 answer

Can Spring Sleuth be used as distributed logging framework

We want to add a tracer id(MDC) across multiple REST services as part of the logging, so we can follow all calls in our log based on the id. Is Spring sleuth suitable for using as distributed logging framework with 100% sampling all the time, or…
fharms
  • 59
  • 1
  • 6
0
votes
0 answers

Debugging spring-cloud-sleuth for HTTP 400

I am using spring-cloud-sleuth:2.0.1.RELEASE with Spring Webflux. When I use curl to send a request to my service, I see the logs like the below indicating trace & span IDs are generated. 18:13:23.739 [reactor-http-nio-5] DEBUG…
illcar
  • 439
  • 1
  • 5
  • 13