问题描述
如何获取特定日期的 Prometheus 指标计数?例如:我需要它 24 小时,在 2020 年 13 月 10 日这一天.
How can I get the Prometheus metrics count for a particular day ? For eg: I would need it for 24 hours, for the day 13-10-2020.
我所看到的只是一种获取过去 24 小时计数的方法:
All I see is a way to get the count for the last 24 hours:
sum(increase(created_total[24h]))
我怎么能在 24 小时内获得相同的计数,但在不同的一天?我花了很长时间试图找出一种方法,但没有运气.有什么指点吗?
How could I get the same count over 24 hours, but for a different day ? I spent quite some time trying to figure out a way but with no luck. Any pointers?
推荐答案
从 Prometheus Graph Console 开始,将 2020-10-13 23:59:59
打入 Moment
代码>字段:
Start with Prometheus Graph Console and punch in 2020-10-13 23:59:59
into the Moment
field:
Graph 也有类似的方法.有范围(=您想要每日统计数据的天数)、结束时间戳(在您的情况下为 2020-10-13 23:59:59
)和分辨率(86400
在您的情况下,以秒为单位 24 小时).
There's a similar way with Graph. There's range (=number of days for which you want daily stats), end timestamp (2020-10-13 23:59:59
in your case) and resolution (86400
in your case, for 24h in seconds).
这篇关于特定时期的 Prometheus 计数查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!