9

即使 Zipkin 运行良好,Sleuth 也不会将跟踪信息发送到 Zipkin。我正在使用 Spring 1.5.8.RELEASE、spring cloud Dalston.SR4,并且在我的微服务中添加了以下依赖项:

<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>

我的日志总是出错:[FOOMS,2e740f33c26e286d,2e740f33c26e286d,false]

我的 Zipkin 依赖项是:

<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>

为什么我在我的 slueth 陈述中变得虚假而不是真实?但是,为所有调用正确生成了 traceId 和 SpanId。我的 Zipkin 在端口 9411 中运行

4

3 回答 3

12

我发现我需要添加一个采样器百分比。默认情况下,发送的样本百分比为零,这就是侦探没有向 zipkin 发送任何内容的原因。当我添加spring.sleuth.sampler.percentage=1.0属性文件时,它开始工作。

于 2017-12-06T10:42:50.080 回答
10

对于最新版本的云依赖关系<version>Finchley.SR2</version>
向 zipkin 发送跟踪的正确属性是:spring.sleuth.sampler.probability=1.0 从百分比变为概率。

于 2019-01-27T00:18:35.267 回答
2

如果要将所有 span 数据导出到 Zipkin,可以通过在 Spring boot 主类中创建 bean 定义来安装采样器

  @Bean
  public Sampler defaultSampler() {
    return new AlwaysSampler();
  }
于 2018-04-15T05:20:04.080 回答