0
votes

I'm using the latest milestone of spring-cloud-sleuth and I can't seem to get traces emitted through opentracing. I have a Tracer bean defined and spring boot seems to acknowledge that, but no traces are being emitted.

Is there a way to check if spring-cloud-sleuth is aware of the Tracer bean?

update

I did see the merged documentation and have a Tracer instance on the bean, as defined below:

@Bean(name = "tracer")
@Primary
public Tracer lightstepTracer() throws MalformedURLException {
    Options opt = lightstepOptionsBuilder.build();
    log.info("Instantiating LightStep JRETracer.");
    return new JRETracer(opt);
}

I'm not explicitly importing the OpenTracing APIs, because the LightStep tracer pulls that in transitively, but I can try doing that.

I've also explicitly enabled OpenTracing support in my application.yml file.

sleuth:
  opentracing:
    enabled: true
1
Can you not name the bean tracer and try again? If that doesn't work then please upload a sample that replicates the issue - Marcin Grzejszczak
I'll try to put together a sample. The bean is named tracer, per the @Bean(name = "tracer") annotation. - wooder
I asked you not to name it tracer and try again - Marcin Grzejszczak
Ah, I read that differently. I can try that and see what happens. - wooder

1 Answers

1
votes

If you go to the latest snapshot documentation (or milestone) and you search for the word OpenTracing, you would get your answer. It's here https://cloud.spring.io/spring-cloud-sleuth/single/spring-cloud-sleuth.html#_opentracing

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

So it's enough to just have OpenTracing on the classpath and Sleuth will work out of the box