简体   繁体   中英

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.

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.

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.

在此处输入图片说明

You're probably looking for increase , rather than rate . Which is the same as 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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