Skip to content

Commit

Permalink
Rename query/series to promql/series
Browse files Browse the repository at this point in the history
  • Loading branch information
prymitive committed Feb 9, 2022
1 parent 7eee024 commit a0dc818
Show file tree
Hide file tree
Showing 8 changed files with 138 additions and 131 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## v0.10.0

### Changed

- `query/series` check was renamed to `promql/series`.


## v0.9.0

### Changed
Expand Down
8 changes: 4 additions & 4 deletions cmd/pint/tests/0023_enabled_checks.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
pint.error -l debug --no-color lint rules
! stdout .
stderr 'level=debug msg="Configured checks for rule" enabled=\["promql/syntax","alerts/for","promql/comparison","alerts/template","promql/fragile","promql/rate\(prom\)","query/series\(prom\)","promql/vector_matching\(prom\)"\] path=rules/1.yaml rule=one'
stderr 'level=debug msg="Configured checks for rule" enabled=\["promql/syntax","alerts/for","promql/comparison","alerts/template","promql/fragile","promql/rate\(prom\)","query/series\(prom\)","promql/vector_matching\(prom\)"\] path=rules/1.yaml rule=two'
stderr 'level=debug msg="Configured checks for rule" enabled=\["promql/syntax","alerts/for","promql/comparison","alerts/template","promql/fragile","promql/rate\(prom\)","query/series\(prom\)","promql/vector_matching\(prom\)"\] path=rules/2.yaml rule=one'
stderr 'level=debug msg="Configured checks for rule" enabled=\["promql/syntax","alerts/for","promql/comparison","alerts/template","promql/fragile","promql/rate\(prom\)","query/series\(prom\)","promql/vector_matching\(prom\)"\] path=rules/2.yaml rule=two'
stderr 'level=debug msg="Configured checks for rule" enabled=\["promql/syntax","alerts/for","promql/comparison","alerts/template","promql/fragile","promql/rate\(prom\)","promql/series\(prom\)","promql/vector_matching\(prom\)"\] path=rules/1.yaml rule=one'
stderr 'level=debug msg="Configured checks for rule" enabled=\["promql/syntax","alerts/for","promql/comparison","alerts/template","promql/fragile","promql/rate\(prom\)","promql/series\(prom\)","promql/vector_matching\(prom\)"\] path=rules/1.yaml rule=two'
stderr 'level=debug msg="Configured checks for rule" enabled=\["promql/syntax","alerts/for","promql/comparison","alerts/template","promql/fragile","promql/rate\(prom\)","promql/series\(prom\)","promql/vector_matching\(prom\)"\] path=rules/2.yaml rule=one'
stderr 'level=debug msg="Configured checks for rule" enabled=\["promql/syntax","alerts/for","promql/comparison","alerts/template","promql/fragile","promql/rate\(prom\)","promql/series\(prom\)","promql/vector_matching\(prom\)"\] path=rules/2.yaml rule=two'

-- rules/1.yaml --
- record: one
Expand Down
2 changes: 1 addition & 1 deletion cmd/pint/tests/0025_config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ level=info msg="Loading configuration file" path=.pint.hcl
"promql/syntax",
"promql/vector_matching",
"query/cost",
"query/series",
"promql/series",
"rule/label",
"rule/reject"
]
Expand Down
10 changes: 5 additions & 5 deletions docs/CONFIGURATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ like memory pressure, Go version, GOGC settings etc.
}
```

## query/series
## promql/series

This check will also query Prometheus servers, it is used to warn about queries
that are using metrics not currently present in Prometheus.
Expand Down Expand Up @@ -880,21 +880,21 @@ groups:

Some checks allow to specify extra parameters.

### query/series
### promql/series

You can disable `query/series` for specific metric using `# pint disable query/series(selector)`
You can disable `promql/series` for specific metric using `# pint disable promql/series(selector)`
comment.
Just like with PromQL if a selector doesn't have any labels then it will match all instances,
if you pass any labels it will only pass time series with those labels.

Disable warnings about missing `my_metric_name`:

```YAML
# pint disable query/series(my_metric_name)
# pint disable promql/series(my_metric_name)
```

Disable it only for `my_metric_name{cluster="dev"}` but still warn about `my_metric_name{cluster="prod"}`:

```YAML
# pint disable query/series(my_metric_name{cluster="dev"})
# pint disable promql/series(my_metric_name{cluster="dev"})
```
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
)

const (
SeriesCheckName = "query/series"
SeriesCheckName = "promql/series"
)

func NewSeriesCheck(prom *promapi.Prometheus) SeriesCheck {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func TestSeriesCheck(t *testing.T) {
{
Fragment: "foo",
Lines: []int{2},
Reporter: "query/series",
Reporter: "promql/series",
Text: "query using prom failed with: bad_data: unhandled query",
Severity: checks.Bug,
},
Expand All @@ -133,7 +133,7 @@ func TestSeriesCheck(t *testing.T) {
{
Fragment: "notfound",
Lines: []int{2},
Reporter: "query/series",
Reporter: "promql/series",
Text: "query using prom completed without any results for notfound",
Severity: checks.Warning,
},
Expand All @@ -147,7 +147,7 @@ func TestSeriesCheck(t *testing.T) {
{
Fragment: "notfound",
Lines: []int{2},
Reporter: "query/series",
Reporter: "promql/series",
Text: "query using prom completed without any results for notfound",
Severity: checks.Warning,
},
Expand All @@ -161,7 +161,7 @@ func TestSeriesCheck(t *testing.T) {
{
Fragment: "notfound",
Lines: []int{2},
Reporter: "query/series",
Reporter: "promql/series",
Text: "query using prom completed without any results for notfound",
Severity: checks.Warning,
},
Expand Down Expand Up @@ -210,7 +210,7 @@ func TestSeriesCheck(t *testing.T) {
{
Fragment: `found{job="notfound"}`,
Lines: []int{2},
Reporter: "query/series",
Reporter: "promql/series",
Text: `query using prom completed without any results for found{job="notfound"}`,
Severity: checks.Warning,
},
Expand All @@ -224,7 +224,7 @@ func TestSeriesCheck(t *testing.T) {
{
Fragment: "notfound",
Lines: []int{2},
Reporter: "query/series",
Reporter: "promql/series",
Text: "query using prom completed without any results for notfound",
Severity: checks.Warning,
},
Expand All @@ -241,7 +241,7 @@ func TestSeriesCheck(t *testing.T) {
{
Fragment: `{__name__="notfound",job="bar"}`,
Lines: []int{3},
Reporter: "query/series",
Reporter: "promql/series",
Text: `query using prom completed without any results for {__name__="notfound",job="bar"}`,
Severity: checks.Warning,
},
Expand All @@ -250,7 +250,7 @@ func TestSeriesCheck(t *testing.T) {
{
description: "series missing but check disabled",
content: `
# pint disable query/series(notfound)
# pint disable promql/series(notfound)
- record: foo
expr: count(notfound) == 0
`,
Expand All @@ -259,7 +259,7 @@ func TestSeriesCheck(t *testing.T) {
{
description: "series missing but check disabled, labels",
content: `
# pint disable query/series(notfound)
# pint disable promql/series(notfound)
- record: foo
expr: count(notfound{job="foo"}) == 0
`,
Expand All @@ -268,7 +268,7 @@ func TestSeriesCheck(t *testing.T) {
{
description: "series missing but check disabled, negative labels",
content: `
# pint disable query/series(notfound)
# pint disable promql/series(notfound)
- record: foo
expr: count(notfound{job!="foo"}) == 0
`,
Expand All @@ -277,7 +277,7 @@ func TestSeriesCheck(t *testing.T) {
{
description: "series missing, disabled comment for labels",
content: `
# pint disable query/series(notfound{job="foo"})
# pint disable promql/series(notfound{job="foo"})
- record: foo
expr: count(notfound) == 0
`,
Expand All @@ -286,7 +286,7 @@ func TestSeriesCheck(t *testing.T) {
{
Fragment: `notfound`,
Lines: []int{4},
Reporter: "query/series",
Reporter: "promql/series",
Text: `query using prom completed without any results for notfound`,
Severity: checks.Warning,
},
Expand Down
Loading

0 comments on commit a0dc818

Please sign in to comment.