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 trace_id in kafka producer callback

Need a possibility to add tracing id from spring-sleuth in kafka producer callback I add a sleuth starter to my POM and create a kafka-producer. I'm looking for a way to add current trace_id to the logs in callback. ListenableFuture
AntonK
  • 91
  • 1
  • 7
0
votes
1 answer

Spring Cloud Sleuth- tracer.getCurrentSpan().getTraceId() does not return the traceid in the logs

When I I print the traceId I get 514775860170850477 however in the logs the trace id is 724d9eadc6e00ad. Any idea what could be happening here? My pom org.springframework.boot
Daniel Haughton
  • 1,085
  • 5
  • 20
  • 45
0
votes
1 answer

Understand Opentracing Standard and Tracers Providers

I'm studying the Opentracing Standard and reading the docs I didn't found the API default Endpoints that should be used by Tracer Providers (Jaeger, LightStep...). Today I'm using Spring Cloud Sleuth to send metrics do Zipkin, and now I have the…
Ronaldo Lanhellas
  • 2,975
  • 5
  • 46
  • 92
0
votes
1 answer

Show Traces in Red colour for Bad Requests in Zipkin UI

I am using spring Boot Version 1.5.14.RELEASE with spring cloud sleuth zipkin. If I return a ResponseEntity setting its HttpStatus as BAD_REQUEST then I see the trace highlighted in Blue color. Is there a way to highlight the trace in Red color for…
0
votes
0 answers

Trace id and other tracing info doesn't appear in log

I have 2 services which are exchanging events via Kafka. First service packs necessary tracing info (headers which are set by brave: traceId, spanId and so on) right in message payload. Consumer of the second service retrieve this information and…
0
votes
1 answer

getting the ID generated by sleuth in response of header section also

I have developed a rest service and I have used the sleuth in my spring boot rest project which generates the random id for every API request in logs which is working perfectly, now the point is that the id which is getting generated in logs by…
0
votes
0 answers

How to add custom logging in spring boot slf4j

I have a problem related to spring microservices distributed tracing. I'm use sleuth library to print trace I'ds. In Java 8, when we use parallelStream it's doesn't work as it is failed to propagate information to other threads. I'm looking for…
0
votes
1 answer

Where is X-B3-SpanId constant defined?

In https://static.javadoc.io/org.springframework.cloud/spring-cloud-sleuth-core/1.2.0.RELEASE/org/springframework/cloud/sleuth/Span.html#SPAN_ID_NAME there's a constant for X-B3-SpanId but that constant does not appear to be in…
Archimedes Trajano
  • 35,625
  • 19
  • 175
  • 265
0
votes
2 answers

Logs with stack traces

I work on service which is based on spring boot 2 , for tracing logs I use spring sleuth and splunk for collecting logs itself. But if there are stack traces in logs it looks weird and stack traces are not marked with tracedID. I have 2…
dm_aq
  • 25
  • 4
0
votes
1 answer

Spring cloud slueth SpanAccessor interface

I am inject SpanAccessor interface from Spring Cloud Slueth, the version I am using is 1.3.3, I want to upgrade to version 2.1.1 where that interface is removed. There is no documentation on what alternate I can use to get this of the SpanAccessor I…
Toseef Zafar
  • 1,601
  • 4
  • 28
  • 46
0
votes
1 answer

Using @SpanTag to tag values for Spring sleuth span does not provide a map to add multiple key value pair

Hi We are using spring sleuth for tracing. To create new span we are using annotation @NewSpan and to add Tags to this new span we are using @SpanTag. Issue we are facing is if we are passing a map as input to method we want to create tags for each…
viren
  • 1,073
  • 1
  • 17
  • 41
0
votes
0 answers

Trace Id not preserved when calling netflix FeignClient

I am using spring-cloud-sleuth-zipkin and spring-cloud-starter-sleuth as dependency. When i call a netflix FeignClient call TraceId changes... import org.springframework.cloud.netflix.feign.FeignClient; @FeignClient public interface TesterClient…
Thomas
  • 213
  • 5
  • 17
0
votes
0 answers

Distributes tracing of order flows

We are running a java trading application and have around 50 orders per second. When an order comes in, it jumps between services and we want to measure latency inside every service and between services by an external service which should gather all…
Mark
  • 423
  • 4
  • 12
0
votes
0 answers

Custom CorrelationId Spring cloud sleuth Finchley.RELEASE

I am currently stuck with one use case in spring-cloud-sleuth. I am using Finchley.Release spring cloud in my pom and Spring boot 2.0.3.RELEASEץ I implemented my own CustomTraceContext which extends CurrentTraceContext and have added a custom…
0
votes
1 answer

logger messages in zipkin

I am new to sleuth and zipkin. I have logged some messages and sleuth is appending trace id and space id for those messages. I am using zipkin to visualize it. I am able to see timings at different microservices. Can we see logger messages(we put at…
Java P
  • 2,241
  • 6
  • 31
  • 45