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

RestTemplate logging interceptor + Spring Cloud Sleuth

I've created a RestTemplate interceptor (ClientHttpRequestInterceptor) to log requests and responses and enabled Spring Cloud Sleuth with the goal of tracing transactions from when the interceptor receives a request to the point where it returns a…
Timothy Perrigo
  • 723
  • 4
  • 18
2
votes
1 answer

Spring Sleuth - broken tracing on JMS ErrorHandler

I've a simple example https://github.com/gtiwari333/sleuth-jms-broken-tracing/tree/master that uses Spring Sleuth with JMS. Here, the call to /jms endpoint queues a message and on receipt of the message at onMessage method, we are doing a GET call…
gtiwari333
  • 24,554
  • 15
  • 75
  • 102
2
votes
1 answer

Autowiring of Spring sleuth Tracer not working in Spring MVC Test

We are using spring boot version 1.5.2.RELEASE and Spring Cloud Sleuth version 1.1.2.RELEASE I am Autowiring Tracer in my service class. @Autowired Tracer tracer When running the application then everything is working fine. Tracer dependency gets…
2
votes
1 answer

Sleuth traceId and spanId are not propagated to parallelStream worker threads

I have integrated Sleuth to my Spring Boot project in order to have a better traceability. It logs perfectly traceId and spanId. However, these fields are not added to logs generated in some operations performed using parallelStream. Sleuth doc…
4chirinos
  • 67
  • 7
2
votes
1 answer

spring sleuth baggage propagation not getting propagated/working

We are currently using sleuth 2.2.3.RELEASE, and we couldn't see the field userId passed in http headers are not propagating. Below is our code. BaggageField REQUEST_ID = BaggageField.create("x-vcap-request-id"); BaggageField USER_ID =…
user3474541
  • 157
  • 3
  • 13
2
votes
2 answers

Spring Cloud Sleuth v2.2.3 how to propagate TraceId to another thread

I am trying to setup tracing of multithread application. I have set up ThreadPool: ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); executor.setCorePoolSize(corePoolSize); executor.setMaxPoolSize(maxPoolSize); …
2
votes
0 answers

Traces not sampled with Istio and Sleuth

I am using Spring Boot 2 Microservices with Spring Cloud Sleuth with the Dependency Management and Spring Cloud Version Greenwich.SR2. My service is running in an Istio service mesh. Sample policy of istio is set to 100 (pilot.traceSampling:…
2
votes
0 answers

Propagate X-B3-TraceId between applications using SNS and SQS

I have 2 spring based applications both of them uses spring-sleuth. Application-1: AmazonSNS snsPublisher; snsPublisher.publish(message) I would like to add MDC context here somehow, so that application-2 can use the same context. Is there any…
2
votes
2 answers

how to force sleuth not send in single b3 header

I'm using sleuth in my Spring Boot application for log tracing, and my application also send some messages via Active MQ, but when i see the message properties, it send the trace with a single b3 header. how can i configure sleuth to separate the…
neorus
  • 477
  • 1
  • 6
  • 19
2
votes
0 answers

Add Spring Sleuth to Spring Oauth2's requests

We have problem with propagation of traceId in requests which are called by spring oauth2 module. For instance consider authorization and resource server. In resource server we have spring security configuration to ensure get rsa public key from…
2
votes
1 answer

Triggering a new Sleuth Tracer for Completable futures

I am trying to implement Slueth for distributed tracing for spring boot microservices which communicates with each other over a messaging channel. One of these microservices is a scheduler that picks up new consumers created for a day. It then runs…
2
votes
1 answer

How can we use Spring Cloud Sleuth with spring MVC project?

I am trying to use spring cloud sleuth with spring web mvc project. We are sending the request from spring web mvc to another spring boot project. I need to have the traceID and spanId to display in the UI. How can we achieve this? EDIT POM.xml for…
2
votes
1 answer

Spring cloud sleuth ExtraFieldPropagation fail in Spring cloud Gateway Filter

We are having three modules Gateway using spring-cloud-gateway, Service1 and Service2. Gateway call service1 and service1 calls service2. Service1 and Service2 are using spring web flux Gateway have 3 filters. global filter, Pre filter and post…
2
votes
2 answers

Spring Sleuth, Log4j2 different trace id in different services

I'm calling from service1 to service2 with microservices configured with spring sleuth. Both microservices has same setup. I'm expecting same trace id for two services, but I'm getting different trace ids. Current output in each services. log in…
2
votes
1 answer

Why isn't Kafka ProducerListener logging trace id and span id?

I have a Kafka instance and a simple spring boot application with one REST controller and a ProducerListener bean. The controller accepts a simple String message and sends it to Kafka via KafkaTemplate. I want the ProducerListener to log an info…