Spring 启动应用程序中的 Sleuth-Zipkin 未激活 OpenTracing

OpenTracing not activating for Sleuth-Zipkin in Spring Boot App

Spring 医生说

Spring Cloud Sleuth is compatible with OpenTracing. If you have OpenTracing on the classpath, we automatically register the OpenTracing Tracer bean. If you wish to disable this, set spring.sleuth.opentracing.enabled to false

我的 POM 中有以下依赖项。

   <dependency>
        <groupId>io.opentracing.contrib</groupId>
        <artifactId>opentracing-spring-cloud-starter</artifactId>
        <version>${version.opentracing.spring}</version>
    </dependency>

但是,当我尝试打印跟踪和跨度信息时,我得到以下打印日志:tracer: NoopTracer

2018-11-19 12:12:03.938 [{X-B3-SpanId=4cd8eed6fe759bd1, X-B3-TraceId=5bf25b3bd0714ae54cd8eed6fe759bd1, X-Span-Export=true, spanExportable=true, spanId=4cd8eed6fe759bd1, traceId=5bf25b3bd0714ae54cd8eed6fe759bd1}] DEBUG ahallim-1ef960 --- [nio-7070-exec-1] a.h.w.RestaurantController               : tracer: NoopTracer
2018-11-19 12:12:03.939 [{X-B3-SpanId=4cd8eed6fe759bd1, X-B3-TraceId=5bf25b3bd0714ae54cd8eed6fe759bd1, X-Span-Export=true, spanExportable=true, spanId=4cd8eed6fe759bd1, traceId=5bf25b3bd0714ae54cd8eed6fe759bd1}]  INFO ahallim-1ef960 --- [nio-7070-exec-1] a.h.w.RestaurantController               : active span: null

我为什么要得到 NopTracer?为什么 Brave 没有像承诺的那样自动注册?我做错了什么吗?

我正在使用

Finchley.SR2

我使用的是 Finchley.SR2 版本系列。一旦我升级到最新的 Spring Boot 和 Spring Cloud 版本,问题就自行解决了。

我删除了 opentracing-spring-cloud-starter 依赖项,现在只使用

   <dependency>
        <groupId>io.opentracing.brave</groupId>
        <artifactId>brave-opentracing</artifactId>
    </dependency>