Search code examples
springspring-bootspring-cloud-sleuthzipkinopentracing

OpenTracing not activating for Sleuth-Zipkin in Spring Boot App


Spring Doc says

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

I have the below dependency in my POM.

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

But, I get the following print out it the logs when I try to print the trace and span information : 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

Why am I getting a NopTracer? Why isn't Brave being registered automatically as promised? Am I doing something wrong?

I am using

Finchley.SR2


Solution

  • I was using Finchley.SR2 train of releases. Once I upgraded to the latest Spring Boot and Spring Cloud versions, the issue fixed itself.

    I removed the opentracing-spring-cloud-starter dependency and am now just using

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