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
2
votes
1 answer

Spring Cloud Sleuth Traces w/ Gradle not showing up in Zipkin

I have a Spring Cloud Sleuth + Stream app working and sending to my local OpenZipkin (docker) when the app uses maven, however when I try to run an gradle spring boot app then Zipkin doesn't display the traces. The interesting thing is that the…
Mrc0113
  • 453
  • 3
  • 13
2
votes
1 answer

Send traces with spring-boot-sleuth to Datadog

I have spring-boot application and it has the next dependencies: dependencies { implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springframework.cloud:spring-cloud-starter-sleuth' developmentOnly…
sergio
  • 23
  • 1
  • 3
2
votes
2 answers

Spring Boot 2.4.4 failed to start after upgrading

I am upgrading Spring boot application, which is currently working on 2.1.13 to 2.4.4. After upgrade, spring boot application is not starting. Few of the modules used in application are as…
2
votes
1 answer

Integration of Spring Cloud Gateway With Spring Cloud Sleuth

I could not find any example which is integrating Spring cloud Sleuth with the Spring Cloud Gateway. Want a Sample Project doing the Integration successfully.
2
votes
0 answers

After switching to Sleuth 3.0.2 TracerContext is always null

I have upgraded Sleuth to version 3.0.2 and started getting NPEs. I know that there were breaking changes, and there is a migration guide, but for the life of me I cannot say how to resolve this issue. [INFO] +-…
Ihor M.
  • 2,728
  • 3
  • 44
  • 70
2
votes
0 answers

Sleuth basic tracing example not working in java

I tried to implement tracing using sleuth-otel. For that, I followed the steps mentioned in the official sleuth-otel documentation. I created a sample project to implement this. but that did't work. I followed this link. This is my pom.xml
2
votes
0 answers

Sleuth 3.0.1 + Spring Cloud Gateway = traceids do not correlate on request/response

Well I have a new setup with Sleuth 3.0.1 where by default spring.sleuth.reactor.instrumentation-type is set to manual Therefore I wrapped all my places where I need to trace with WebFluxSleuthOperators.withSpanInScope(tracer, currentTraceContext,…
2
votes
1 answer

Java Spring Sleuth Zipkin - X-Span-Export not being displayed

Small question as I am not able to see X-Span-Export in my logs please. I have an app, which is Java based, with Springboot 2.4.2, with Sleuth and Zipkin. In my log4j2.xml, I configured such: %d{MM-dd…
PatPanda
  • 3,644
  • 9
  • 58
  • 154
2
votes
1 answer

Spring cloud sleuth 3.0.1 generate traceid & spanid in logs using logback

I am using spring-cloud-starter-sleuth:3.0.1 and spring-cloud-sleuth-zipkin:3.0.1 to generate traceId and spanId in log file. I was able to get those in logs using 2.2.7.RELEASE version. I have tried using logback but not able to have with 3.0.1…
Ronak
  • 21
  • 3
2
votes
1 answer

Keep trace/span across CompletableFuture in Spring Cloud Sleuth

I am using Sleuth with CompletableFuture.handle. Example: log.info("first"); apnsClient.sendNotification(...).handle((response, cause) -> { log.info("second"); }); I want the second log to have the same trace id as the first log. However, it…
ch271828n
  • 15,854
  • 5
  • 53
  • 88
2
votes
2 answers

Zipkin is not connecting to RabbitMQ

Please, notice that this question can seem a duplicate of this one, but it's not the case. Below I include my rational I'm trying to add Sleuth/Zipkin trace to my project. For this I have followed this tutorial. My project is already using RabbitMQ…
Sourcerer
  • 1,891
  • 1
  • 19
  • 32
2
votes
1 answer

Can't see traceId and spanId in log for Sleuth

I've started learning Sleuth and I'm stuck at logging config. I have this config:
laban_luka
  • 399
  • 1
  • 4
  • 11
2
votes
1 answer

How to pass Sleuth MDC context over Google PubSub message

I am following a micro-service based architecture for my service development. I want to trace each of my request through various microservice calls in my system. My microservices are communicating over Google PubSub messaging framework. I am not…
Ady
  • 584
  • 8
  • 16
2
votes
2 answers

Rename X-B3-TraceId headers in spring cloud sleuth

I have few services written in Node that are using "X-Request-Id" as the header to identify requests. I am now writing services in Java using spring-boot where I can use spring-cloud-sleuth to track traceId and spanId. However, I would like to…
Pravesh Jain
  • 4,128
  • 6
  • 28
  • 47
2
votes
1 answer

How to enable spring cloud sleuth in unit tests with MockMvc

We have a spring boot rest api (spring boot 2.3.0.RELEASE) that uses spring cloud sleuth (version 2.2.3.RELEASE). At some point, we use the trace id from spring sleuth as data. The trace id is fetched by autowiring the Tracing bean and then…
Dries Cleymans
  • 770
  • 8
  • 20