0

I am trying to use sleuth and Zipkin in a demo spring boot application.

I have added the required dependency in pom.xml and in order to export the details from sleuth to Zipkin, I have explicitly defined it below in application.properties. However, the default value is any way true.

spring.zipkin.enabled=true

But the export flag is not coming as true always, and hence the request meta info is not getting exported to Zipkin for each request I am hitting from the postman.

2022-11-02 13:46:31.099  INFO [demo3,def8e3343c003e5b,def8e3343c003e5b,true] 5678 --- [nio-9096-exec-2] c.t.d.c.UserOperationController          : hello world !!
2022-11-02 13:46:32.402  INFO [demo3,699027e047256ffe,699027e047256ffe,false] 5678 --- [nio-9096-exec-3] c.t.d.c.UserOperationController          : hello world !!
2022-11-02 13:46:49.732  INFO [demo3,3ff7224335d16add,3ff7224335d16add,false] 5678 --- [nio-9096-exec-4] c.t.d.c.UserOperationController          : hello !!
2022-11-02 13:47:03.246  INFO [demo3,fe1532a4c9d1658c,fe1532a4c9d1658c,true] 5678 --- [nio-9096-exec-5] c.t.d.c.UserOperationController          : hello !!
2022-11-02 13:47:31.545  INFO [demo3,8669a3fdb484934b,8669a3fdb484934b,false] 5678 --- [nio-9096-exec-6] c.t.d.c.UserOperationController          : hello !!
2022-11-02 13:47:47.479  INFO [demo3,b2bcd756ca4e8014,b2bcd756ca4e8014,false] 5678 --- [nio-9096-exec-7] c.t.d.c.UserOperationController          : hello world !!
2022-11-02 13:47:58.467  INFO [demo3,a1d97721b926bdc0,a1d97721b926bdc0,false] 5678 --- [nio-9096-exec-8] c.t.d.c.UserOperationController          : hello world !!
2022-11-02 13:48:01.102  INFO [demo3,1b9af943d513d8b6,1b9af943d513d8b6,false] 5678 --- [nio-9096-exec-9] c.t.d.c.UserOperationController          : hello world !!
2022-11-02 13:48:03.894  INFO [demo3,1db119acd65e0add,1db119acd65e0add,false] 5678 --- [io-9096-exec-10] c.t.d.c.UserOperationController          : hello world !!

Note that, I have defined two apis in UserOperationController as below:

    @GetMapping("/view")
    public List<AuditDetailsResponse> viewAll() {
        logger.info("hello world !!");
        return userOperationService.viewAll();
    }
    
    @GetMapping("/view/{username}")
    public AuditDetailsResponse view(@PathVariable("username") String username) {
        logger.info("hello !!");
        return userOperationService.view(username);
    }

Could anyone help me to understand how this export flag is actually working and how I can make this value as true always?

Happs
  • 115
  • 7
  • 1
    I wonder if what you mean is that sampling is not enabled for all calls (which is a good thing). If you want to sample all set `spring.sleuth.sampler.percentage=1`. – Augusto Nov 02 '22 at 10:30
  • @Augusto, thanks for the answer, it does solve my problem. Also, the reader can refer [link](https://stackoverflow.com/questions/49182626/spring-sleuth-stuck-sending-10-percent-of-request-to-zipkin). Note that: The correct property is `spring.sleuth.sampler.probability=100`. But why you mentioned that it is a good thing to not enable sampling for all calls? – Happs Nov 02 '22 at 12:21
  • Hi Aman. Limiting sampling will have a smaller impact on the performance of the application; will send less data to whatever you are using to collect data; and will use less processing and storage in that system. Take for example a service that processes 1000 req/s. That would be 1000 traces (and also traces on downstream services!), if one limits the rate (or percentage) to 60, then only 60 requests from those 1000 will be traced. You don't want to overload your metrics/APM platform, as that could impact diagnosing issues. – Augusto Nov 02 '22 at 20:19

0 Answers0