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

Add traceId in sleuth from request header

I want to use spring cloud sleuth in my application. For each request I am getting "traceId" in the header and I want sleuth to use this as trace id. But the issue is sleuth is taking trace id from header only when the key is "X-B3-TraceId". So to…
0
votes
1 answer

How to use Spring Cloud Sleuth for tracing Kafka streams

How to trace Kafka based events using Spring Cloud sleuth? Whatever examples I saw were for rest APIs. I am looking for kafka-clients library. Also is it a good idea to use Spring cloud sleuth for this or should I pass my traceIds via headers…
0
votes
1 answer

SpanID and TraceID missing in Spring Boot logs

For example, before including Spring Cloud Sleuth, people get something like this in their logs 2016-02-11 17:12:45.404 INFO [my-service-id,,] 85184 --- [nio-8080-exec-1] com.example.MySimpleComponentMakingARequest with the 2 commas (which is…
VIOLET
  • 71
  • 1
  • 9
0
votes
1 answer

spring-cloud-starter-sleuth + axon-tracing-spring-boot-starter =?

The title says it all. Is it possible to get spring-cloud-starter-sleuth working together with axon-tracing-spring-boot-starter? current log output: 2021-06-02 15:12:36.449 INFO [,2b2fc6a322588b0e,114b332e7847e95f] 14716 --- [nio-8082-exec-5]…
0
votes
0 answers

Spring boot 2.4.x with spring cloud 2020.0X fails Build

I want to upgrade spring cloud version to 2020.0.X inorder to use both spring-cloud-starter-sleuth:jar:3.0.0 and spring-cloud-sleuth-otel-autoconfigure:jar:1.0.0-M7 so i upgraded the following dependencies in our project.
0
votes
1 answer

Configuring spring cloud sleuth and logback to log baggage fields

Following the spring cloud sleuth documentation, I've configured an app properties with the following: spring.sleuth.baggage.remote-fields=x-header-to-log spring.sleuth.baggage.correlation-fields=x-header-to-log I've then added a…
0
votes
1 answer

What tags are available in RestTemplate-instrumented spans using Spring Cloud Sleuth

I'm including Spring Cloud Sleuth + Zipkin 2.2.7 in my Spring Boot application, and am using injected RestTemplates so that calls to them are instrumented and sent to zipkin. My zipkin spans arising from RestTemplate calls contain tags for…
wabrit
  • 217
  • 2
  • 14
0
votes
1 answer

Could not find artifact com.wavefront:wavefront-spring-boot-bom:pom:2.1.1-SNAPSHOT

I am using spring-cloud-sleuth-otel-autoconfigure dependency for distributed tracing. Getting error while mvn clean install -X Actual error message is Could not find artifact com.wavefront:wavefront-spring-boot-bom:pom:2.1.1-SNAPSHOT in…
0
votes
1 answer

How to change the Span Name for a REST Endpoint with Spring Cloud Sleuth

I am using Spring Cloud Sleuth to create traces. I am exposing a REST endpoint using Spring Boot like this: @SpanName("calculate-reviews") @GetMapping(path = "/reviews/{productId}") public Reviews bookReviewsById(@PathVariable String…
FloW
  • 139
  • 10
0
votes
1 answer

Tracer Giving Null Pointer Exception in Spring Cloud Contract Test

I Am getting below Null Pointer Exception because tracer.currentSpan() method is not able to generate Span object in Spring Cloud Contract Test environment. I tried few different approaches like explicit approach using setter and…
0
votes
0 answers

SpringBoot - SpringCloud Sleuth Zipkin - Tracing - Passing around traceId

Quick question on how to pass around the original trace id traceId please. The entire end to end flow is a call between a client ClientA to three other micro services (four in total). ClientA (team A) -> Service B1 (team B) -> Service B2 (team B) ->…
PatPanda
  • 3,644
  • 9
  • 58
  • 154
0
votes
0 answers

how to use sleuth in springboot

A strange problem occured when I integrated sleuth into my applications. here is the maven dependency. org.springframework.cloud spring-cloud-starter-sleuth
william
  • 265
  • 4
  • 17
0
votes
2 answers

Why tracing information do not propagate over kafka messages when Spring Sleuth is in the classpath?

Tracing information do not propagate over kafka messages due to the method SleuthKafkaAspect.wrapProducerFactory() is not triggered. On the producer side, the message is correctly sent and the tracing information is correctly logged. On consumer…
user1800752
  • 29
  • 1
  • 6
0
votes
1 answer

Lettuce throws NPE when the dependencis has spring-cloud-starter-sleuth

I use spring-session-data-redis to manage sessions. It will get session data from redis before every request. But it throws a NPE when get session from redis. And if I remove spring-cloud-starter-sleuth dependency, it won't happend. springboot…
0
votes
1 answer

Spring Cloud Sleuth and Spring Cloud Stream Kinesis - How to propagate trace IDs?

Do Spring Cloud Sleuth tracing headers get injected into Spring Cloud Stream Kinesis messages like they do for RabbitMq and Kafka as described here? We have a REST controller that, after processing a POST request but right before sending the…
Keith Bennett
  • 733
  • 11
  • 25