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
13
votes
4 answers

How does Spring Cloud Sleuth propagate the MDC context in Webflux ouf of the box so that its content can be logged in different threads?

I'd like to know how Spring Cloud Sleuth propagates the MDC context between threads making the MDC params available each of them. I've read this article https://simonbasle.github.io/2018/02/contextual-logging-with-reactor-context-and-mdc/ that…
13
votes
7 answers

Adding the traceId from Spring Cloud Sleuth to response

I am currently implementing Spring Cloud Sleuth in our project. I have a requirement to add the traceId to the response headers. Is there a way that this can be achieved? Thanks, Anoop
Anoop
  • 813
  • 2
  • 10
  • 24
12
votes
3 answers

Spring Cloud Sleuth + log4j2

Some of my microservices use log4j2 as logger. Spring cloud Sleuth has support for logback. How can I use Sleuth to get distributed tracing in this scenario. I understand to use sleuth with log4j2, I have to implement certain class. I tried this but…
barun
  • 393
  • 1
  • 5
  • 19
10
votes
3 answers

Spring Cloud Sleuth- Get current traceId?

I am using Sleuth and I am wondering is it possible to get the current traceId? I dont need to add it any responses or anything. I just want the traceId for emails alerting the development team in certain situations.
Daniel Haughton
  • 1,085
  • 5
  • 20
  • 45
10
votes
3 answers

Sleuth not sending trace information to Zipkin

Sleuth is not sending the trace information to Zipkin, even though Zipkin is running fine. I am using Spring 1.5.8.RELEASE, spring cloud Dalston.SR4 and I have added the below dependencies in my microservices:
codingsplash
  • 4,785
  • 12
  • 51
  • 90
9
votes
2 answers

Disable distributed tracing for development

We are setting up microservice framework. We use following stack for distributed tracing. Spring boot Kafka Zipkin Following is how the configuration is done In gradle.build (or pom.xml) following starter dependencies added compile…
9
votes
1 answer

Spring cloud sleuth with Spring data jpa

We are trying to implement Spring cloud sleuth with Zipkin in our project and wanted to know if Spring cloud sleuth will support DB calls with Spring data JPA. I want to trace the time taken for DB calls just like service calls When I make a service…
RDR
  • 473
  • 4
  • 15
8
votes
1 answer

Spring boot 3 issue with micrometer tracing with handling Traceparent header

I have below code which handle requests from other apps which pass the traceId through Traceparent header. I expect it will hydrate the parent traceId from the request, and in zipkin dashboard I should see the connection between this app and other…
8
votes
1 answer

why need Spring sleuth when spring-cloud-starter-zipkin uses zipkin.brave?

Adding just spring-cloud-starter-zipkin also able to generate spanId and TraceId so what is the need of Sleuth? spring-cloud-starter-zipkin actually pulling io.zipkin.brave by itself not Sleuth.
8
votes
2 answers

Spring sleuth with SpringBoot (log correlation) - Traceid & SpanId Not displayed

I have an existing Spring boot (2.2.0) application and trying to integrate Spring cloud sleuth to get automatic trace and span id. The logback file is as follows -
ashishhsihsa
  • 103
  • 1
  • 1
  • 6
7
votes
1 answer

spring-cloud-sleuth does not show any info in logs after adding dependencies

I have added sleuth dependencies to my Spring boot project. Though the dependencies are present, no trace information is seen in logs. There are no compile or run time errors.
ERR
  • 415
  • 2
  • 6
  • 20
7
votes
1 answer

How to configure spring-cloud-gateway to use sleuth to log request/response body

I am looking to develop a gateway server based on spring-cloud-gateway:2.0.2-RELEASE and would like to utilize sleuth for logging purposes. I have sleuth running since when I write to the log I see the Sleuth details (span Id, etc), but I an hoping…
brunch
  • 623
  • 1
  • 6
  • 11
7
votes
0 answers

Spring sleuth generate custom trace id

I need to customize the way spring sleuth generates the trace id value: in my case the client sends a correlation id using a query param and I would like to use that value as trace id. Is that possible? How? Thanks in advance.
Pirulino
  • 758
  • 1
  • 9
  • 20
7
votes
2 answers

Spring Cloud Sleuth with OpenTracing

Is there a way to use Spring Cloud Sleuth with OpenTracing? I want to connect Spring clients with Jaeger
Javier Sainz
  • 301
  • 1
  • 2
  • 7
7
votes
1 answer

Sleuth log traceId not propagated to another service

I try to add a distributed tracing in my microservices (under Kubernetes in Azure). I added the dependencies in the parent pom.xml : org.springframework.boot spring-boot-starter-parent
Michaël L
  • 469
  • 5
  • 17
1
2 3
42 43