Micrometer - Prometheus Gauge displays NaN

后端 未结 4 1151
一个人的身影
一个人的身影 2021-02-20 12:59

I am trying to generate Prometheus metrics with using Micrometer.io with Spring Boot 2.0.0.RELEASE.

When I am trying to expose the size of a List as Gauge, it ke

4条回答
  •  自闭症患者
    2021-02-20 13:42

    my example for gauge using

    private final AtomicLong countTryUsers = new AtomicLong(0);
    Metrics.gauge("app.countTry", countTryUsers);
    
    public void updateCountTryUsers(Long countTryUsersDb){
       countTryUsers.set(countTryUsersDb);
    }
    

    so I register app.countTry just once, and then just update AtomicLong countTryUsers over custom method updateCountTryUsers()

提交回复
热议问题