spring-cloud/spring-cloud-sleuth

spring.zipkin.discoveryClientEnabled ignored when the traced app is webflux

codefromthecrypt opened this issue · 1 comments

Describe the bug

Documentation says to use spring.zipkin.discoveryClientEnabled to report spans to Zipkin discovered (likely in Eureka). Technically, ZipkinUrlExtractor will do the work, to subsitute the application name encoded as the hostname in spring.zipkin.baseUrl for a usable instance.

However, if ConditionalOnWebApplication.Type.REACTIVE triggers, then none of this happens and reporting to zipkin fails, as the fake hostname wasn't substituted.

Sample

Make an app like this and it triggers reactive reporting.. Since the async reporter buffers actual work from the production requests, onto a separate thread, there really should be no reason to restrict Eureka depending on which frontend is in use.

  @GetMapping("/api")
  public Mono<String> printDate(@RequestHeader("user_name") Optional<String> username) {
    return Mono.fromSupplier(() -> {
      String date = LocalDate.now().toString();
      return username.map(u -> date + " " + u).orElse(date);
    });
  }

thanks and verified manually and going forward automatically that this works. Thanks @marcingrzejszczak! openzipkin/brave-example#113