0

We have a spring-boot application (spring-boot-starter-parent-2.0.0.RELEASE) using spring-cloud-starter-zipkin for writing "spans" to zipkin.

We use spring-integration too (through spring-boot-starter-integration) and we have added an integration flow with a PollableChannel to be used within a poller:

@Bean
public PollableChannel pollableChannel() {
    return new QueueChannel(100);
}

@Bean
@ServiceActivator(poller = @Poller(taskExecutor="batchTaskExecutor"), 
                  inputChannel= "pollableChannel")
public MyHandler myHandler() {
    return new MyHandler();
}

Since adding this configuration, we are having an "asynch" span every second. It seems this span comes from the @Poller, checking whether there are items in the queue.

I'd like to know how to control this span. Is it possible to disable? Specially if there are no items.

Thanks in advance!

jalogar
  • 1,604
  • 19
  • 27

1 Answers1

1

If it comes from the @Scheduled method then you can use https://github.com/spring-cloud/spring-cloud-sleuth/blob/master/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/scheduling/SleuthSchedulingProperties.java#L38 (spring.sleuth.scheduled.skipPattern) to find the thread and disable it. If you say its name is async then it means that it comes from a TraceRunnable or TraceCallable. That can be problematic to get rid off. You can file an issue in Sleuth to allow SpanAdjuster to actually not send spans to Zipkin (by for example returning null). You can also try to disable async at all spring.sleuth.async.enabled. If you're not using any other features of async that should not interfere.

Marcin Grzejszczak
  • 10,624
  • 1
  • 16
  • 32
  • 1
    Thanks for the response, it helps me pointing to the right path. It turned out the span comes from the ThreadPoolTaskExecutor that the @Poller uses. I've created a pull request with an improvement to disable instrumentation in executors by name -> https://github.com/spring-cloud/spring-cloud-sleuth/pull/1035 – jalogar Jul 24 '18 at 12:00