Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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:

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-sleuth</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-zipkin</artifactId>
</dependency>

My Logs are always coming false: [FOOMS,2e740f33c26e286d,2e740f33c26e286d,false]

My Zipkin dependencies are:

<dependency>
    <groupId>io.zipkin.java</groupId>
    <artifactId>zipkin-server</artifactId>
</dependency>
<dependency>
    <groupId>io.zipkin.java</groupId>
    <artifactId>zipkin-autoconfigure-ui</artifactId>
    <scope>runtime</scope>
</dependency>

Why am I getting false instead of true in my slueth statements? The traceId and SpanId are properly generated for all the calls though. My Zipkin is running in port 9411

like image 225
codingsplash Avatar asked Dec 06 '17 09:12

codingsplash


People also ask

Is zipkin deprecated?

spring-cloud-starter-zipkin is deprecated, you should not use it anymore. You can use spring-cloud-starter-sleuth and spring-cloud-sleuth-zipkin ( 3. x ).

What is the difference between Zipkin and sleuth?

And as we have already mentioned, Sleuth works automatically with resttemplate so it would send this instrumented service call information to the attached Zipkin server. Zipkin will then start the book keeping of latency calculation along with a few other statistics like service call details.

What is zipkin distributed tracing?

Zipkin is a Java-based distributed tracing system to collect and look up data from distributed systems. Too many things could happen when a request to an HTTP application is made. A request could include a call to a database engine, to a cache server, or any other dependency like another microservice.

What is TraceId and SpanId in sleuth?

TraceId – This is an id that is assigned to a single request, job, or action. Something like each unique user initiated web request will have its own traceId. SpanId – Tracks a unit of work. Think of a request that consists of multiple steps. Each step could have its own spanId and be tracked individually.


3 Answers

For the latest version of cloud dependencies <version>Finchley.SR2</version>
The correct property to send traces to zipkin is: spring.sleuth.sampler.probability=1.0 Which has changed from percentage to probability.

like image 109
Matt Avatar answered Oct 12 '22 00:10

Matt


I found that I need to add a sampler percentage. By default zero percentage of the samples are sent and that is why the sleuth was not sending anything to zipkin. when I added spring.sleuth.sampler.percentage=1.0 in the properties files, it started working.

like image 45
codingsplash Avatar answered Oct 12 '22 00:10

codingsplash


If you are exporting all the span data to Zipkin, sampler can be installed by creating a bean definition in the Spring boot main class

  @Bean
  public Sampler defaultSampler() {
    return new AlwaysSampler();
  }
like image 21
jramapurath Avatar answered Oct 12 '22 00:10

jramapurath