简体   繁体   English

普罗米修斯在 pushgateway 重新启动时计数和总和度量

[英]Prometheus count and sum metric over restart of pushgateway

I want to count how often a user opens a dialog in a frontend and send the results to the prometheus pushgateway.我想计算用户在前端打开对话框并将结果发送到 prometheus pushgateway 的频率。

The problem is that once the gateway restarts the metrics are gone and I can not sum the values properly.问题是,一旦网关重新启动,指标就消失了,我无法正确地对这些值求和。

在此处输入图片说明

The rate function seems not to fit for this purpose. rate 函数似乎不适合这个目的。

Is there the possibility to sum over time, no matter there where restarts or not?无论是否重新启动,是否有可能随着时间的推移求和?

Here is the sum query but shows not what I expect.这是总和查询,但显示的不是我所期望的。 在此处输入图片说明

maybe sum_over_time could do it if I group them, but if I add the by clause it throws an error.如果我将它们分组,也许 sum_over_time 可以做到,但是如果我添加 by 子句,它会引发错误。

在此处输入图片说明

You're probably looking for increase , rather than rate .您可能正在寻找increase ,而不是rate Which is the same as rate * <interval_length_in_seconds> .这与rate * <interval_length_in_seconds>

As a side note, in theory Pushgateway persists its state across restarts, but if you're running it within Docker or Kubernetes you would need to set up a persistent volume to be used by your successive Pushgateway instances.作为旁注,理论上 Pushgateway 会在重启后保持其状态,但如果您在 Docker 或 Kubernetes 中运行它,则需要设置一个持久卷以供后续的 Pushgateway 实例使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM