普罗米修斯过滤器矢量通过day_of_week

时间:2019-04-14 07:21:57

标签: filter prometheus dayofweek promql

我使用子查询来获取上周的每小时汇总值:例如:整个上周每小时的HTTP请求数,它将在范围向量中返回168个值。

delta(http_server_requests_seconds_count[1h])[1w:1h]

现在,我想过滤该值以仅返回特定工作日的值,可以说仅返回星期一的24值。 我发现了有关day_of_week,时间戳,bool expr的一些提示,但是我无法将它们结合起来以使其正常工作,或者可能吗?像这样:

delta(http_server_requests_seconds_count[1h])[1w:1h] bool day_of_week() == 1

1 个答案:

答案 0 :(得分:1)

将开始/结束时间调整为全天会更有效,但是您可以这样做:

(increase(http_server_requests_seconds_count[1h]) and on () day_of_week() == 1)[1w:1h]