Search code examples
javaspring-webfluxspring-cloud-sleuth

Spring Webflux + Sleuth Zipkin: Proof of duplicate requests?


Small question regarding duplicates requests with Spring Webflux + Sleuth Zipkin server please.

I have a server, which code is super simple:

    @PostMapping("/question")
    public Mono<String> question() {
        LOGGER.info("This has been called!");
        return someService.getResponse();
    }

Every hour, I expect only one client that I know to call this endpoint only once.

Therefore, every hour, I do see this in my log:

INFO [myservice,c3a25fb0fb7426b7,c3a25fb0fb7426b7] 10 --- [or-http-epoll-3] c.my.Controller  : This has been called!

So far so good.

The issue is that several times, I did see in my logs:

INFO [myservice,5278cfd673fddc60,1582c3da8d01adaa] 10 --- [or-http-epoll-2] c.my.Controller  : This has been called!
INFO [myservice,5278cfd673fddc60,c8a85b0275b6bfdd] 10 --- [or-http-epoll-3] c.my.Controller  : This has been called!

Very naturally, I assume the only client I know, instead of calling me once as expected, called me twice.

However, the logs on client side shows only one http outbound request has been made.

May I ask, seeing same trace ID, but different Span ID is enough to prove, be hard evidence there is at least two requests sent?

Can the [or-http-epoll-2] and [or-http-epoll-3] help proving as well?

With the only information written here, is it possible to prove anything regarding the duplicates please?

Thank you


Solution

  • You can prove this by turning on access logs. Having the same traceID for two different log events does not prove anything, it can happen that:

    • The client called you twice
    • The client called you once but you created another span
    • The client called you and another client which also called you

    You can enable access logs which can prove this or you can use a rq/rs log library (like logbook) that does this for you. I recommend simply enabling the access logs.