From ac03e835afc11e6f4b6f18be720985fc6e6720fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mierzwa?= Date: Tue, 4 May 2021 10:31:26 +0100 Subject: [PATCH] fix(backend): use correct label selectors --- CHANGELOG.md | 6 ++++++ cmd/karma/alert_history.go | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aa407cde8..2019dcc88 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## [unreleased] + +### Fixed + +- History queries were always failing due to wrong Prometheus API usage. + ## v0.84 ### Added diff --git a/cmd/karma/alert_history.go b/cmd/karma/alert_history.go index 940fce7a3..e6329ffe8 100644 --- a/cmd/karma/alert_history.go +++ b/cmd/karma/alert_history.go @@ -248,7 +248,7 @@ func countAlerts(uri string, timeout time.Duration, labels map[string]string) (r names, _, err := v1api.LabelNames( ctx, - []string{`__name__="ALERTS_FOR_STATE"`}, + []string{`{__name__="ALERTS_FOR_STATE"}`}, time.Now().Add(time.Minute*-5), time.Now()) if err != nil {