From 3374eace2f08b3d04ccf74e4ef28dbb3a654e545 Mon Sep 17 00:00:00 2001 From: Lukasz Mierzwa Date: Thu, 3 Mar 2022 14:55:56 +0000 Subject: [PATCH] Raise promql/series severity from Warning to Bug --- cmd/pint/tests/0055_prometheus_failover.txt | 2 +- docs/changelog.md | 3 ++- internal/checks/promql_series.go | 2 +- internal/checks/promql_series_test.go | 14 +++++++------- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/cmd/pint/tests/0055_prometheus_failover.txt b/cmd/pint/tests/0055_prometheus_failover.txt index f8115755..815ecf88 100644 --- a/cmd/pint/tests/0055_prometheus_failover.txt +++ b/cmd/pint/tests/0055_prometheus_failover.txt @@ -1,7 +1,7 @@ exec bash -x ./prometheus.sh & exec bash -c 'I=0 ; while [ ! -f prometheus.pid ] && [ $I -lt 30 ]; do sleep 1; I=$((I+1)); done' -pint.ok --no-color lint rules +pint.error --no-color lint rules ! stdout . stderr 'level=error msg="Query failed" error="Post \\"http://127.0.0.1:1055/api/v1/query\\": dial tcp 127.0.0.1:1055: connect: connection refused" query=count\(foo\) uri=http://127.0.0.1:1055' stderr 'level=error msg="Failed to query Prometheus configuration" error="Get \\"http://127.0.0.1:1055/api/v1/status/config\\": dial tcp 127.0.0.1:1055: connect: connection refused" uri=http://127.0.0.1:1055' diff --git a/docs/changelog.md b/docs/changelog.md index 771f0853..7af2bc4c 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,10 +1,11 @@ # Changelog -## v0.14.1 +## v0.15.0 ### Changed - Always print the number of detected problems when running `pint lint`. +- Raise `promql/series` severity from `Warning` to `Bug`. ## v0.14.0 diff --git a/internal/checks/promql_series.go b/internal/checks/promql_series.go index 2a83070a..51f4ffa5 100644 --- a/internal/checks/promql_series.go +++ b/internal/checks/promql_series.go @@ -96,7 +96,7 @@ func (c SeriesCheck) countSeries(ctx context.Context, expr parser.PromQLExpr, se Lines: expr.Lines(), Reporter: c.Reporter(), Text: fmt.Sprintf("query using %q on %s completed without any results for %s", c.prom.Name(), qr.URI, selector.String()), - Severity: Warning, + Severity: Bug, }) return } diff --git a/internal/checks/promql_series_test.go b/internal/checks/promql_series_test.go index 3c4c8e10..b11fe255 100644 --- a/internal/checks/promql_series_test.go +++ b/internal/checks/promql_series_test.go @@ -149,7 +149,7 @@ func TestSeriesCheck(t *testing.T) { Lines: []int{2}, Reporter: "promql/series", Text: fmt.Sprintf(`query using "prom" on %s completed without any results for notfound`, srv.URL), - Severity: checks.Warning, + Severity: checks.Bug, }, }, }, @@ -163,7 +163,7 @@ func TestSeriesCheck(t *testing.T) { Lines: []int{2}, Reporter: "promql/series", Text: fmt.Sprintf(`query using "prom" on %s completed without any results for notfound`, srv.URL), - Severity: checks.Warning, + Severity: checks.Bug, }, }, }, @@ -177,7 +177,7 @@ func TestSeriesCheck(t *testing.T) { Lines: []int{2}, Reporter: "promql/series", Text: fmt.Sprintf(`query using "prom" on %s completed without any results for notfound`, srv.URL), - Severity: checks.Warning, + Severity: checks.Bug, }, }, }, @@ -226,7 +226,7 @@ func TestSeriesCheck(t *testing.T) { Lines: []int{2}, Reporter: "promql/series", Text: fmt.Sprintf(`query using "prom" on %s completed without any results for found{job="notfound"}`, srv.URL), - Severity: checks.Warning, + Severity: checks.Bug, }, }, }, @@ -240,7 +240,7 @@ func TestSeriesCheck(t *testing.T) { Lines: []int{2}, Reporter: "promql/series", Text: fmt.Sprintf(`query using "prom" on %s completed without any results for notfound`, srv.URL), - Severity: checks.Warning, + Severity: checks.Bug, }, }, }, @@ -257,7 +257,7 @@ func TestSeriesCheck(t *testing.T) { Lines: []int{3}, Reporter: "promql/series", Text: fmt.Sprintf(`query using "prom" on %s completed without any results for {__name__="notfound",job="bar"}`, srv.URL), - Severity: checks.Warning, + Severity: checks.Bug, }, }, }, @@ -302,7 +302,7 @@ func TestSeriesCheck(t *testing.T) { Lines: []int{4}, Reporter: "promql/series", Text: fmt.Sprintf(`query using "prom" on %s completed without any results for notfound`, srv.URL), - Severity: checks.Warning, + Severity: checks.Bug, }, }, },