Sleuth not sending trace information to Zipkin
Asked Answered
C

3

10

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

Cleavable answered 6/12, 2017 at 9:31 Comment(0)
C
13

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.

Cleavable answered 6/12, 2017 at 10:42 Comment(2)
cloud.spring.io/spring-cloud-static/Edgware.RELEASE/multi/… in the IMPORTANT section it's written that: > If using Zipkin, configure the percentage of spans exported using spring.sleuth.sampler.percentage (default 0.1, i.e. 10%). Otherwise you might think that Sleuth is not working cause it’s omitting some spans.Stepp
In recent version the key is changed to "spring.sleuth.sampler.probability".Scornik
K
13

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.

Kenzi answered 27/1, 2019 at 0:18 Comment(0)
P
2

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();
  }
Protrusile answered 15/4, 2018 at 5:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.