Skip to content

Commit

Permalink
Fix recording rule errors the label values change (#6)
Browse files Browse the repository at this point in the history
This fixes the following problem:

You define an SLO with label mylabel=original. Let that run for a while. Then you change the label to mylabel=changed. This will cause the slo:sli_error:ratio_rate<window> to fail for the duration of the window with the error vector contains metrics with the same labelset after applying rule labels.

To fix this problem we essentially discard the labels from the query. They are then re-applied to the resulting recording rule.

Note that this uses sub-queries so you need to be running a version of Prometheus that supports that.
  • Loading branch information
Guðmundur Björn Birkisson authored Aug 31, 2023
1 parent cb76276 commit f813004
Show file tree
Hide file tree
Showing 30 changed files with 140 additions and 140 deletions.
6 changes: 3 additions & 3 deletions examples/_gen/getting-started.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ groups:
tier: "2"
- record: slo:sli_error:ratio_rate30d
expr: |
sum_over_time(slo:sli_error:ratio_rate5m{sloth_id="myservice-requests-availability", sloth_service="myservice", sloth_slo="requests-availability"}[30d])
/ ignoring (sloth_window)
count_over_time(slo:sli_error:ratio_rate5m{sloth_id="myservice-requests-availability", sloth_service="myservice", sloth_slo="requests-availability"}[30d])
sum_over_time(sum(slo:sli_error:ratio_rate5m{sloth_id="myservice-requests-availability", sloth_service="myservice", sloth_slo="requests-availability"})[30d:])
/
count_over_time(sum(slo:sli_error:ratio_rate5m{sloth_id="myservice-requests-availability", sloth_service="myservice", sloth_slo="requests-availability"})[30d:])
labels:
cmd: examplesgen.sh
owner: myteam
Expand Down
12 changes: 6 additions & 6 deletions examples/_gen/home-wifi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ groups:
sloth_window: 3d
- record: slo:sli_error:ratio_rate30d
expr: |
sum_over_time(slo:sli_error:ratio_rate5m{sloth_id="home-wifi-good-wifi-client-satisfaction", sloth_service="home-wifi", sloth_slo="good-wifi-client-satisfaction"}[30d])
/ ignoring (sloth_window)
count_over_time(slo:sli_error:ratio_rate5m{sloth_id="home-wifi-good-wifi-client-satisfaction", sloth_service="home-wifi", sloth_slo="good-wifi-client-satisfaction"}[30d])
sum_over_time(sum(slo:sli_error:ratio_rate5m{sloth_id="home-wifi-good-wifi-client-satisfaction", sloth_service="home-wifi", sloth_slo="good-wifi-client-satisfaction"})[30d:])
/
count_over_time(sum(slo:sli_error:ratio_rate5m{sloth_id="home-wifi-good-wifi-client-satisfaction", sloth_service="home-wifi", sloth_slo="good-wifi-client-satisfaction"})[30d:])
labels:
cluster: valhalla
cmd: examplesgen.sh
Expand Down Expand Up @@ -347,9 +347,9 @@ groups:
sloth_window: 3d
- record: slo:sli_error:ratio_rate30d
expr: |
sum_over_time(slo:sli_error:ratio_rate5m{sloth_id="home-wifi-risk-wifi-client-satisfaction", sloth_service="home-wifi", sloth_slo="risk-wifi-client-satisfaction"}[30d])
/ ignoring (sloth_window)
count_over_time(slo:sli_error:ratio_rate5m{sloth_id="home-wifi-risk-wifi-client-satisfaction", sloth_service="home-wifi", sloth_slo="risk-wifi-client-satisfaction"}[30d])
sum_over_time(sum(slo:sli_error:ratio_rate5m{sloth_id="home-wifi-risk-wifi-client-satisfaction", sloth_service="home-wifi", sloth_slo="risk-wifi-client-satisfaction"})[30d:])
/
count_over_time(sum(slo:sli_error:ratio_rate5m{sloth_id="home-wifi-risk-wifi-client-satisfaction", sloth_service="home-wifi", sloth_slo="risk-wifi-client-satisfaction"})[30d:])
labels:
cluster: valhalla
cmd: examplesgen.sh
Expand Down
6 changes: 3 additions & 3 deletions examples/_gen/k8s-getting-started.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ spec:
tier: "2"
record: slo:sli_error:ratio_rate3d
- expr: |
sum_over_time(slo:sli_error:ratio_rate5m{sloth_id="myservice-requests-availability", sloth_service="myservice", sloth_slo="requests-availability"}[30d])
/ ignoring (sloth_window)
count_over_time(slo:sli_error:ratio_rate5m{sloth_id="myservice-requests-availability", sloth_service="myservice", sloth_slo="requests-availability"}[30d])
sum_over_time(sum(slo:sli_error:ratio_rate5m{sloth_id="myservice-requests-availability", sloth_service="myservice", sloth_slo="requests-availability"})[30d:])
/
count_over_time(sum(slo:sli_error:ratio_rate5m{sloth_id="myservice-requests-availability", sloth_service="myservice", sloth_slo="requests-availability"})[30d:])
labels:
cmd: examplesgen.sh
owner: myteam
Expand Down
12 changes: 6 additions & 6 deletions examples/_gen/k8s-home-wifi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ spec:
sloth_window: 3d
record: slo:sli_error:ratio_rate3d
- expr: |
sum_over_time(slo:sli_error:ratio_rate5m{sloth_id="home-wifi-good-wifi-client-satisfaction", sloth_service="home-wifi", sloth_slo="good-wifi-client-satisfaction"}[30d])
/ ignoring (sloth_window)
count_over_time(slo:sli_error:ratio_rate5m{sloth_id="home-wifi-good-wifi-client-satisfaction", sloth_service="home-wifi", sloth_slo="good-wifi-client-satisfaction"}[30d])
sum_over_time(sum(slo:sli_error:ratio_rate5m{sloth_id="home-wifi-good-wifi-client-satisfaction", sloth_service="home-wifi", sloth_slo="good-wifi-client-satisfaction"})[30d:])
/
count_over_time(sum(slo:sli_error:ratio_rate5m{sloth_id="home-wifi-good-wifi-client-satisfaction", sloth_service="home-wifi", sloth_slo="good-wifi-client-satisfaction"})[30d:])
labels:
cluster: valhalla
cmd: examplesgen.sh
Expand Down Expand Up @@ -359,9 +359,9 @@ spec:
sloth_window: 3d
record: slo:sli_error:ratio_rate3d
- expr: |
sum_over_time(slo:sli_error:ratio_rate5m{sloth_id="home-wifi-risk-wifi-client-satisfaction", sloth_service="home-wifi", sloth_slo="risk-wifi-client-satisfaction"}[30d])
/ ignoring (sloth_window)
count_over_time(slo:sli_error:ratio_rate5m{sloth_id="home-wifi-risk-wifi-client-satisfaction", sloth_service="home-wifi", sloth_slo="risk-wifi-client-satisfaction"}[30d])
sum_over_time(sum(slo:sli_error:ratio_rate5m{sloth_id="home-wifi-risk-wifi-client-satisfaction", sloth_service="home-wifi", sloth_slo="risk-wifi-client-satisfaction"})[30d:])
/
count_over_time(sum(slo:sli_error:ratio_rate5m{sloth_id="home-wifi-risk-wifi-client-satisfaction", sloth_service="home-wifi", sloth_slo="risk-wifi-client-satisfaction"})[30d:])
labels:
cluster: valhalla
cmd: examplesgen.sh
Expand Down
12 changes: 6 additions & 6 deletions examples/_gen/k8s-multifile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ spec:
tier: "2"
record: slo:sli_error:ratio_rate3d
- expr: |
sum_over_time(slo:sli_error:ratio_rate5m{sloth_id="myservice-requests-availability", sloth_service="myservice", sloth_slo="requests-availability"}[30d])
/ ignoring (sloth_window)
count_over_time(slo:sli_error:ratio_rate5m{sloth_id="myservice-requests-availability", sloth_service="myservice", sloth_slo="requests-availability"}[30d])
sum_over_time(sum(slo:sli_error:ratio_rate5m{sloth_id="myservice-requests-availability", sloth_service="myservice", sloth_slo="requests-availability"})[30d:])
/
count_over_time(sum(slo:sli_error:ratio_rate5m{sloth_id="myservice-requests-availability", sloth_service="myservice", sloth_slo="requests-availability"})[30d:])
labels:
cmd: examplesgen.sh
owner: myteam
Expand Down Expand Up @@ -374,9 +374,9 @@ spec:
tier: "1"
record: slo:sli_error:ratio_rate3d
- expr: |
sum_over_time(slo:sli_error:ratio_rate5m{sloth_id="myservice2-requests-availability", sloth_service="myservice2", sloth_slo="requests-availability"}[30d])
/ ignoring (sloth_window)
count_over_time(slo:sli_error:ratio_rate5m{sloth_id="myservice2-requests-availability", sloth_service="myservice2", sloth_slo="requests-availability"}[30d])
sum_over_time(sum(slo:sli_error:ratio_rate5m{sloth_id="myservice2-requests-availability", sloth_service="myservice2", sloth_slo="requests-availability"})[30d:])
/
count_over_time(sum(slo:sli_error:ratio_rate5m{sloth_id="myservice2-requests-availability", sloth_service="myservice2", sloth_slo="requests-availability"})[30d:])
labels:
cmd: examplesgen.sh
owner: myteam2
Expand Down
12 changes: 6 additions & 6 deletions examples/_gen/kubernetes-apiserver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ groups:
sloth_window: 3d
- record: slo:sli_error:ratio_rate30d
expr: |
sum_over_time(slo:sli_error:ratio_rate5m{sloth_id="k8s-apiserver-requests-availability", sloth_service="k8s-apiserver", sloth_slo="requests-availability"}[30d])
/ ignoring (sloth_window)
count_over_time(slo:sli_error:ratio_rate5m{sloth_id="k8s-apiserver-requests-availability", sloth_service="k8s-apiserver", sloth_slo="requests-availability"}[30d])
sum_over_time(sum(slo:sli_error:ratio_rate5m{sloth_id="k8s-apiserver-requests-availability", sloth_service="k8s-apiserver", sloth_slo="requests-availability"})[30d:])
/
count_over_time(sum(slo:sli_error:ratio_rate5m{sloth_id="k8s-apiserver-requests-availability", sloth_service="k8s-apiserver", sloth_slo="requests-availability"})[30d:])
labels:
category: availability
cluster: valhalla
Expand Down Expand Up @@ -386,9 +386,9 @@ groups:
sloth_window: 3d
- record: slo:sli_error:ratio_rate30d
expr: |
sum_over_time(slo:sli_error:ratio_rate5m{sloth_id="k8s-apiserver-requests-latency", sloth_service="k8s-apiserver", sloth_slo="requests-latency"}[30d])
/ ignoring (sloth_window)
count_over_time(slo:sli_error:ratio_rate5m{sloth_id="k8s-apiserver-requests-latency", sloth_service="k8s-apiserver", sloth_slo="requests-latency"}[30d])
sum_over_time(sum(slo:sli_error:ratio_rate5m{sloth_id="k8s-apiserver-requests-latency", sloth_service="k8s-apiserver", sloth_slo="requests-latency"})[30d:])
/
count_over_time(sum(slo:sli_error:ratio_rate5m{sloth_id="k8s-apiserver-requests-latency", sloth_service="k8s-apiserver", sloth_slo="requests-latency"})[30d:])
labels:
category: latency
cluster: valhalla
Expand Down
12 changes: 6 additions & 6 deletions examples/_gen/multifile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ groups:
tier: "2"
- record: slo:sli_error:ratio_rate30d
expr: |
sum_over_time(slo:sli_error:ratio_rate5m{sloth_id="myservice-requests-availability", sloth_service="myservice", sloth_slo="requests-availability"}[30d])
/ ignoring (sloth_window)
count_over_time(slo:sli_error:ratio_rate5m{sloth_id="myservice-requests-availability", sloth_service="myservice", sloth_slo="requests-availability"}[30d])
sum_over_time(sum(slo:sli_error:ratio_rate5m{sloth_id="myservice-requests-availability", sloth_service="myservice", sloth_slo="requests-availability"})[30d:])
/
count_over_time(sum(slo:sli_error:ratio_rate5m{sloth_id="myservice-requests-availability", sloth_service="myservice", sloth_slo="requests-availability"})[30d:])
labels:
cmd: examplesgen.sh
owner: myteam
Expand Down Expand Up @@ -355,9 +355,9 @@ groups:
tier: "1"
- record: slo:sli_error:ratio_rate30d
expr: |
sum_over_time(slo:sli_error:ratio_rate5m{sloth_id="myservice2-requests-availability", sloth_service="myservice2", sloth_slo="requests-availability"}[30d])
/ ignoring (sloth_window)
count_over_time(slo:sli_error:ratio_rate5m{sloth_id="myservice2-requests-availability", sloth_service="myservice2", sloth_slo="requests-availability"}[30d])
sum_over_time(sum(slo:sli_error:ratio_rate5m{sloth_id="myservice2-requests-availability", sloth_service="myservice2", sloth_slo="requests-availability"})[30d:])
/
count_over_time(sum(slo:sli_error:ratio_rate5m{sloth_id="myservice2-requests-availability", sloth_service="myservice2", sloth_slo="requests-availability"})[30d:])
labels:
cmd: examplesgen.sh
owner: myteam2
Expand Down
6 changes: 3 additions & 3 deletions examples/_gen/no-alerts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@ groups:
sloth_window: 3d
- record: slo:sli_error:ratio_rate30d
expr: |
sum_over_time(slo:sli_error:ratio_rate5m{sloth_id="myapp-http-availability", sloth_service="myapp", sloth_slo="http-availability"}[30d])
/ ignoring (sloth_window)
count_over_time(slo:sli_error:ratio_rate5m{sloth_id="myapp-http-availability", sloth_service="myapp", sloth_slo="http-availability"}[30d])
sum_over_time(sum(slo:sli_error:ratio_rate5m{sloth_id="myapp-http-availability", sloth_service="myapp", sloth_slo="http-availability"})[30d:])
/
count_over_time(sum(slo:sli_error:ratio_rate5m{sloth_id="myapp-http-availability", sloth_service="myapp", sloth_slo="http-availability"})[30d:])
labels:
cmd: examplesgen.sh
owner: myteam
Expand Down
6 changes: 3 additions & 3 deletions examples/_gen/openslo-getting-started.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ groups:
sloth_window: 3d
- record: slo:sli_error:ratio_rate30d
expr: |
sum_over_time(slo:sli_error:ratio_rate5m{sloth_id="my-service-sloth-slo-my-service-0", sloth_service="my-service", sloth_slo="sloth-slo-my-service-0"}[30d])
/ ignoring (sloth_window)
count_over_time(slo:sli_error:ratio_rate5m{sloth_id="my-service-sloth-slo-my-service-0", sloth_service="my-service", sloth_slo="sloth-slo-my-service-0"}[30d])
sum_over_time(sum(slo:sli_error:ratio_rate5m{sloth_id="my-service-sloth-slo-my-service-0", sloth_service="my-service", sloth_slo="sloth-slo-my-service-0"})[30d:])
/
count_over_time(sum(slo:sli_error:ratio_rate5m{sloth_id="my-service-sloth-slo-my-service-0", sloth_service="my-service", sloth_slo="sloth-slo-my-service-0"})[30d:])
labels:
cmd: examplesgen.sh
sloth_id: my-service-sloth-slo-my-service-0
Expand Down
18 changes: 9 additions & 9 deletions examples/_gen/openslo-kubernetes-apiserver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ groups:
sloth_window: 3d
- record: slo:sli_error:ratio_rate30d
expr: |
sum_over_time(slo:sli_error:ratio_rate5m{sloth_id="k8s-apiserver-requests-availability-openslo-0", sloth_service="k8s-apiserver", sloth_slo="requests-availability-openslo-0"}[30d])
/ ignoring (sloth_window)
count_over_time(slo:sli_error:ratio_rate5m{sloth_id="k8s-apiserver-requests-availability-openslo-0", sloth_service="k8s-apiserver", sloth_slo="requests-availability-openslo-0"}[30d])
sum_over_time(sum(slo:sli_error:ratio_rate5m{sloth_id="k8s-apiserver-requests-availability-openslo-0", sloth_service="k8s-apiserver", sloth_slo="requests-availability-openslo-0"})[30d:])
/
count_over_time(sum(slo:sli_error:ratio_rate5m{sloth_id="k8s-apiserver-requests-availability-openslo-0", sloth_service="k8s-apiserver", sloth_slo="requests-availability-openslo-0"})[30d:])
labels:
cmd: examplesgen.sh
sloth_id: k8s-apiserver-requests-availability-openslo-0
Expand Down Expand Up @@ -355,9 +355,9 @@ groups:
sloth_window: 3d
- record: slo:sli_error:ratio_rate30d
expr: |
sum_over_time(slo:sli_error:ratio_rate5m{sloth_id="k8s-apiserver-requests-latency-openslo-0", sloth_service="k8s-apiserver", sloth_slo="requests-latency-openslo-0"}[30d])
/ ignoring (sloth_window)
count_over_time(slo:sli_error:ratio_rate5m{sloth_id="k8s-apiserver-requests-latency-openslo-0", sloth_service="k8s-apiserver", sloth_slo="requests-latency-openslo-0"}[30d])
sum_over_time(sum(slo:sli_error:ratio_rate5m{sloth_id="k8s-apiserver-requests-latency-openslo-0", sloth_service="k8s-apiserver", sloth_slo="requests-latency-openslo-0"})[30d:])
/
count_over_time(sum(slo:sli_error:ratio_rate5m{sloth_id="k8s-apiserver-requests-latency-openslo-0", sloth_service="k8s-apiserver", sloth_slo="requests-latency-openslo-0"})[30d:])
labels:
cmd: examplesgen.sh
sloth_id: k8s-apiserver-requests-latency-openslo-0
Expand Down Expand Up @@ -563,9 +563,9 @@ groups:
sloth_window: 3d
- record: slo:sli_error:ratio_rate30d
expr: |
sum_over_time(slo:sli_error:ratio_rate5m{sloth_id="k8s-apiserver-requests-latency-openslo-1", sloth_service="k8s-apiserver", sloth_slo="requests-latency-openslo-1"}[30d])
/ ignoring (sloth_window)
count_over_time(slo:sli_error:ratio_rate5m{sloth_id="k8s-apiserver-requests-latency-openslo-1", sloth_service="k8s-apiserver", sloth_slo="requests-latency-openslo-1"}[30d])
sum_over_time(sum(slo:sli_error:ratio_rate5m{sloth_id="k8s-apiserver-requests-latency-openslo-1", sloth_service="k8s-apiserver", sloth_slo="requests-latency-openslo-1"})[30d:])
/
count_over_time(sum(slo:sli_error:ratio_rate5m{sloth_id="k8s-apiserver-requests-latency-openslo-1", sloth_service="k8s-apiserver", sloth_slo="requests-latency-openslo-1"})[30d:])
labels:
cmd: examplesgen.sh
sloth_id: k8s-apiserver-requests-latency-openslo-1
Expand Down
6 changes: 3 additions & 3 deletions examples/_gen/plugin-getting-started.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ groups:
tier: "2"
- record: slo:sli_error:ratio_rate30d
expr: |
sum_over_time(slo:sli_error:ratio_rate5m{sloth_id="myservice-requests-availability", sloth_service="myservice", sloth_slo="requests-availability"}[30d])
/ ignoring (sloth_window)
count_over_time(slo:sli_error:ratio_rate5m{sloth_id="myservice-requests-availability", sloth_service="myservice", sloth_slo="requests-availability"}[30d])
sum_over_time(sum(slo:sli_error:ratio_rate5m{sloth_id="myservice-requests-availability", sloth_service="myservice", sloth_slo="requests-availability"})[30d:])
/
count_over_time(sum(slo:sli_error:ratio_rate5m{sloth_id="myservice-requests-availability", sloth_service="myservice", sloth_slo="requests-availability"})[30d:])
labels:
cmd: examplesgen.sh
owner: myteam
Expand Down
6 changes: 3 additions & 3 deletions examples/_gen/plugin-k8s-getting-started.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ spec:
tier: "2"
record: slo:sli_error:ratio_rate3d
- expr: |
sum_over_time(slo:sli_error:ratio_rate5m{sloth_id="myservice-requests-availability", sloth_service="myservice", sloth_slo="requests-availability"}[30d])
/ ignoring (sloth_window)
count_over_time(slo:sli_error:ratio_rate5m{sloth_id="myservice-requests-availability", sloth_service="myservice", sloth_slo="requests-availability"}[30d])
sum_over_time(sum(slo:sli_error:ratio_rate5m{sloth_id="myservice-requests-availability", sloth_service="myservice", sloth_slo="requests-availability"})[30d:])
/
count_over_time(sum(slo:sli_error:ratio_rate5m{sloth_id="myservice-requests-availability", sloth_service="myservice", sloth_slo="requests-availability"})[30d:])
labels:
cmd: examplesgen.sh
owner: myteam
Expand Down
6 changes: 3 additions & 3 deletions examples/_gen/raw-home-wifi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ groups:
sloth_window: 3d
- record: slo:sli_error:ratio_rate30d
expr: |
sum_over_time(slo:sli_error:ratio_rate5m{sloth_id="home-wifi-wifi-client-satisfaction", sloth_service="home-wifi", sloth_slo="wifi-client-satisfaction"}[30d])
/ ignoring (sloth_window)
count_over_time(slo:sli_error:ratio_rate5m{sloth_id="home-wifi-wifi-client-satisfaction", sloth_service="home-wifi", sloth_slo="wifi-client-satisfaction"}[30d])
sum_over_time(sum(slo:sli_error:ratio_rate5m{sloth_id="home-wifi-wifi-client-satisfaction", sloth_service="home-wifi", sloth_slo="wifi-client-satisfaction"})[30d:])
/
count_over_time(sum(slo:sli_error:ratio_rate5m{sloth_id="home-wifi-wifi-client-satisfaction", sloth_service="home-wifi", sloth_slo="wifi-client-satisfaction"})[30d:])
labels:
cluster: valhalla
cmd: examplesgen.sh
Expand Down
2 changes: 1 addition & 1 deletion internal/app/generate/prometheus_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ func TestIntegrationAppServiceGenerate(t *testing.T) {
},
{
Record: "slo:sli_error:ratio_rate30d",
Expr: "sum_over_time(slo:sli_error:ratio_rate5m{sloth_id=\"test-id\", sloth_service=\"test-svc\", sloth_slo=\"test-name\"}[30d])\n/ ignoring (sloth_window)\ncount_over_time(slo:sli_error:ratio_rate5m{sloth_id=\"test-id\", sloth_service=\"test-svc\", sloth_slo=\"test-name\"}[30d])\n",
Expr: "sum_over_time(sum(slo:sli_error:ratio_rate5m{sloth_id=\"test-id\", sloth_service=\"test-svc\", sloth_slo=\"test-name\"})[30d:])\n/\ncount_over_time(sum(slo:sli_error:ratio_rate5m{sloth_id=\"test-id\", sloth_service=\"test-svc\", sloth_slo=\"test-name\"})[30d:])\n",
Labels: map[string]string{
"test_label": "label_1",
"extra_k1": "extra_v1",
Expand Down
6 changes: 3 additions & 3 deletions internal/prometheus/recording_rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@ func optimizedSLIRecordGenerator(slo SLO, window, shortWindow time.Duration) (*r
// that is 1 (thats why we can use `count`), giving use a correct ratio of ratios:
// - https://prometheus.io/docs/practices/rules/
// - https://math.stackexchange.com/questions/95909/why-is-an-average-of-an-average-usually-incorrect
const sliExprTplFmt = `sum_over_time({{.metric}}{{.filter}}[{{.window}}])
/ ignoring ({{.windowKey}})
count_over_time({{.metric}}{{.filter}}[{{.window}}])
const sliExprTplFmt = `sum_over_time(sum({{.metric}}{{.filter}})[{{.window}}:])
/
count_over_time(sum({{.metric}}{{.filter}})[{{.window}}:])
`

if window == shortWindow {
Expand Down
Loading

0 comments on commit f813004

Please sign in to comment.