【问题标题】:SpringBoot Actuator Maintain StateSpring Boot 执行器保持状态
【发布时间】:2021-12-28 03:42:55
【问题描述】:

我正在使用千分尺将自定义指标推送到 Prometheus。因此,prometheus 抓取/actuator/prometheus 并存储数据。但问题是,当我重新部署我的应用程序时,所有值都重置为 0。

例如:我将请求计数推送到 prometheus。请求计数达到 5。出于某种原因,我部署了更新版本的 SpringBoot 应用程序。由于执行器在内存中,因此没有请求计数将从 0 开始。所以,我的普罗米修斯图正在下降到 0 并重新开始。

我该如何解决这个问题?

【问题讨论】:

  • 指标的存储不是在 Spring App 中完成的,而是存储在你的 prometheus 存储中。

标签: spring-boot prometheus spring-boot-actuator spring-micrometer


【解决方案1】:

这是预期的行为。引用"Prometheus Counters and how to deal with them"

计数器的当前值无关紧要。重要的是,它如何随着时间的推移而增加。

因此,要解决您的问题,请通过应用 rate()increase() 来解决您的查询。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-05-01
    • 1970-01-01
    • 2014-04-07
    • 1970-01-01
    • 1970-01-01
    • 2016-02-13
    • 2016-08-09
    • 2018-08-29
    相关资源
    最近更新 更多