From 1839858fca674f83177c7dd53b08e4d812637c05 Mon Sep 17 00:00:00 2001 From: Douglas Camata <159076+douglascamata@users.noreply.github.com> Date: Wed, 8 Feb 2023 07:03:18 +0100 Subject: [PATCH] Mixins(Rule): Fix query for long rule evaluations (#6103) * mixin(Rule): Fix query for long rule evaluations Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com> * Update changelog Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com> --------- Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com> --- CHANGELOG.md | 1 + examples/dashboards/rule.json | 2 +- mixin/dashboards/rule.libsonnet | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bbdacc1b87..690a1ae256 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re - [#6050](https://github.com/thanos-io/thanos/pull/6050) Store: Re-try bucket store initial sync upon failure. - [#6067](https://github.com/thanos-io/thanos/pull/6067) Receive: fixed panic when querying uninitialized TSDBs. - [#6082](https://github.com/thanos-io/thanos/pull/6082) Store: Don't error when no stores are matched. +- [#6103](https://github.com/thanos-io/thanos/pull/6103) Mixins(Rule): Fix query for long rule evaluations. ### Changed diff --git a/examples/dashboards/rule.json b/examples/dashboards/rule.json index f7d7843859..569a5aaeec 100644 --- a/examples/dashboards/rule.json +++ b/examples/dashboards/rule.json @@ -197,7 +197,7 @@ "steppedLine": false, "targets": [ { - "expr": "(\n max by(job, rule_group) (prometheus_rule_group_last_duration_seconds{job=~\"$job\"})\n >\n sum by(job, rule_group) (prometheus_rule_group_interval_seconds{job=~\"$job\"})\n)\n", + "expr": "(\n sum by(job, rule_group) (prometheus_rule_group_last_duration_seconds{job=~\"$job\"})\n >\n sum by(job, rule_group) (prometheus_rule_group_interval_seconds{job=~\"$job\"})\n)\n", "format": "time_series", "intervalFactor": 2, "legendFormat": "{{ rule_group }}", diff --git a/mixin/dashboards/rule.libsonnet b/mixin/dashboards/rule.libsonnet index b62814f099..411544d10a 100644 --- a/mixin/dashboards/rule.libsonnet +++ b/mixin/dashboards/rule.libsonnet @@ -38,7 +38,7 @@ local utils = import '../lib/utils.libsonnet'; g.queryPanel( ||| ( - max by(%(dimensions)s, rule_group) (prometheus_rule_group_last_duration_seconds{%(selector)s}) + sum by(%(dimensions)s, rule_group) (prometheus_rule_group_last_duration_seconds{%(selector)s}) > sum by(%(dimensions)s, rule_group) (prometheus_rule_group_interval_seconds{%(selector)s}) )