Skip to content

Commit

Permalink
Drop lines label from pint_problem metric
Browse files Browse the repository at this point in the history
  • Loading branch information
prymitive committed Feb 4, 2022
1 parent 14d1915 commit 1c6e0d7
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 9 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## v0.9.0

### Changed

- Removed `lines` label from `pint_problem` metric exported when running `pint watch`.

## v0.8.2

### Added
Expand Down
2 changes: 1 addition & 1 deletion cmd/pint/tests/0042_watch_metrics.txt
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ pint_check_duration_seconds_count{check="promql/syntax"}
pint_check_iterations_total
# HELP pint_problem Prometheus rule problem reported by pint
# TYPE pint_problem gauge
pint_problem{kind="recording",lines="2",name="broken",problem="syntax error: no arguments for aggregate expression provided",reporter="promql/syntax",severity="fatal"}
pint_problem{kind="recording",name="broken",problem="syntax error: no arguments for aggregate expression provided",reporter="promql/syntax",severity="fatal"}
# HELP pint_problems Total number of problems reported by pint
# TYPE pint_problems gauge
pint_problems
Expand Down
2 changes: 1 addition & 1 deletion cmd/pint/tests/0048_watch_limit.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ rule {
}

-- metrics.txt --
pint_problem{kind="recording",lines="2",name="broken",problem="syntax error: no arguments for aggregate expression provided",reporter="promql/syntax",severity="fatal"} 1
pint_problem{kind="recording",name="broken",problem="syntax error: no arguments for aggregate expression provided",reporter="promql/syntax",severity="fatal"} 1
pint_problems 1
6 changes: 3 additions & 3 deletions cmd/pint/tests/0049_watch_severity_warning.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ rule {
}

-- metrics.txt --
pint_problem{kind="alerting",lines="8",name="comparison",problem="alert query doesn't have any condition, it will always fire if the metric exists",reporter="promql/comparison",severity="warning"} 1
pint_problem{kind="recording",lines="2",name="broken",problem="syntax error: no arguments for aggregate expression provided",reporter="promql/syntax",severity="fatal"} 1
pint_problem{kind="recording",lines="5",name="aggregate",problem="job label is required and should be preserved when aggregating \"^.+$\" rules, remove job from without()",reporter="promql/aggregate",severity="warning"} 1
pint_problem{kind="alerting",name="comparison",problem="alert query doesn't have any condition, it will always fire if the metric exists",reporter="promql/comparison",severity="warning"} 1
pint_problem{kind="recording",name="aggregate",problem="job label is required and should be preserved when aggregating \"^.+$\" rules, remove job from without()",reporter="promql/aggregate",severity="warning"} 1
pint_problem{kind="recording",name="broken",problem="syntax error: no arguments for aggregate expression provided",reporter="promql/syntax",severity="fatal"} 1
pint_problems 3
2 changes: 1 addition & 1 deletion cmd/pint/tests/0050_watch_severity_fatal.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ rule {
}

-- metrics.txt --
pint_problem{kind="recording",lines="2",name="broken",problem="syntax error: no arguments for aggregate expression provided",reporter="promql/syntax",severity="fatal"} 1
pint_problem{kind="recording",name="broken",problem="syntax error: no arguments for aggregate expression provided",reporter="promql/syntax",severity="fatal"} 1
pint_problems 1
4 changes: 1 addition & 3 deletions cmd/pint/watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
"github.com/cloudflare/pint/internal/checks"
"github.com/cloudflare/pint/internal/config"
"github.com/cloudflare/pint/internal/discovery"
"github.com/cloudflare/pint/internal/output"
"github.com/cloudflare/pint/internal/reporter"

"github.com/prometheus/client_golang/prometheus"
Expand Down Expand Up @@ -219,7 +218,7 @@ func newProblemCollector(cfg config.Config, paths []string, minSeverity checks.S
problem: prometheus.NewDesc(
"pint_problem",
"Prometheus rule problem reported by pint",
[]string{"kind", "name", "severity", "reporter", "problem", "lines"},
[]string{"kind", "name", "severity", "reporter", "problem"},
prometheus.Labels{},
),
problems: prometheus.NewDesc(
Expand Down Expand Up @@ -293,7 +292,6 @@ func (c *problemCollector) Collect(ch chan<- prometheus.Metric) {
strings.ToLower(report.Problem.Severity.String()),
report.Problem.Reporter,
report.Problem.Text,
output.FormatLineRangeString(report.Problem.Lines),
)

var out dto.Metric
Expand Down

0 comments on commit 1c6e0d7

Please sign in to comment.