Skip to content

Commit 4a29db5

Browse files
authored
Merge pull request #1247 from cloudflare/errors
Reformat some errors
2 parents 0aae64c + d46edfa commit 4a29db5

File tree

5 files changed

+23
-23
lines changed

5 files changed

+23
-23
lines changed

cmd/pint/tests/0054_watch_metrics_prometheus.txt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -90,19 +90,19 @@ pint_last_run_duration_seconds
9090
pint_last_run_time_seconds
9191
# HELP pint_problem Prometheus rule problem reported by pint
9292
# TYPE pint_problem gauge
93-
pint_problem{filename="rules/1.yml",kind="recording",name="aggregate",owner="",problem="Couldn't run \"promql/counter\" checks due to `prom2` Prometheus server at http://127.0.0.1:1054 connection error: `connection refused`.",reporter="promql/counter",severity="bug"}
94-
pint_problem{filename="rules/1.yml",kind="recording",name="aggregate",owner="",problem="Couldn't run \"promql/range_query\" checks due to `prom2` Prometheus server at http://127.0.0.1:1054 connection error: `connection refused`.",reporter="promql/range_query",severity="bug"}
95-
pint_problem{filename="rules/1.yml",kind="recording",name="aggregate",owner="",problem="Couldn't run \"promql/rate\" checks due to `prom1` Prometheus server at http://127.0.0.1:7054 connection error: `server_error: 500 Internal Server Error`.",reporter="promql/rate",severity="bug"}
96-
pint_problem{filename="rules/1.yml",kind="recording",name="aggregate",owner="",problem="Couldn't run \"promql/rate\" checks due to `prom2` Prometheus server at http://127.0.0.1:1054 connection error: `connection refused`.",reporter="promql/rate",severity="bug"}
97-
pint_problem{filename="rules/1.yml",kind="recording",name="aggregate",owner="",problem="Couldn't run \"promql/series\" checks due to `prom2` Prometheus server at http://127.0.0.1:1054 connection error: `connection refused`.",reporter="promql/series",severity="bug"}
93+
pint_problem{filename="rules/1.yml",kind="recording",name="aggregate",owner="",problem="Couldn't run `promql/counter` checks due to `prom2` Prometheus server at http://127.0.0.1:1054 connection error: `connection refused`.",reporter="promql/counter",severity="bug"}
94+
pint_problem{filename="rules/1.yml",kind="recording",name="aggregate",owner="",problem="Couldn't run `promql/range_query` checks due to `prom2` Prometheus server at http://127.0.0.1:1054 connection error: `connection refused`.",reporter="promql/range_query",severity="bug"}
95+
pint_problem{filename="rules/1.yml",kind="recording",name="aggregate",owner="",problem="Couldn't run `promql/rate` checks due to `prom1` Prometheus server at http://127.0.0.1:7054 connection error: `server_error: 500 Internal Server Error`.",reporter="promql/rate",severity="bug"}
96+
pint_problem{filename="rules/1.yml",kind="recording",name="aggregate",owner="",problem="Couldn't run `promql/rate` checks due to `prom2` Prometheus server at http://127.0.0.1:1054 connection error: `connection refused`.",reporter="promql/rate",severity="bug"}
97+
pint_problem{filename="rules/1.yml",kind="recording",name="aggregate",owner="",problem="Couldn't run `promql/series` checks due to `prom2` Prometheus server at http://127.0.0.1:1054 connection error: `connection refused`.",reporter="promql/series",severity="bug"}
9898
pint_problem{filename="rules/1.yml",kind="recording",name="aggregate",owner="",problem="`prom1` Prometheus server at http://127.0.0.1:7054 failed with: `bad_data: bogus query`.",reporter="promql/series",severity="bug"}
9999
pint_problem{filename="rules/1.yml",kind="recording",name="broken",owner="",problem="Prometheus failed to parse the query with this PromQL error: no arguments for aggregate expression provided.",reporter="promql/syntax",severity="fatal"}
100-
pint_problem{filename="rules/2.yml",kind="alerting",name="comparison",owner="bob and alice",problem="Couldn't run \"alerts/external_labels\" checks due to `prom1` Prometheus server at http://127.0.0.1:7054 connection error: `server_error: 500 Internal Server Error`.",reporter="alerts/external_labels",severity="bug"}
101-
pint_problem{filename="rules/2.yml",kind="alerting",name="comparison",owner="bob and alice",problem="Couldn't run \"alerts/external_labels\" checks due to `prom2` Prometheus server at http://127.0.0.1:1054 connection error: `connection refused`.",reporter="alerts/external_labels",severity="bug"}
102-
pint_problem{filename="rules/2.yml",kind="alerting",name="comparison",owner="bob and alice",problem="Couldn't run \"promql/range_query\" checks due to `prom2` Prometheus server at http://127.0.0.1:1054 connection error: `connection refused`.",reporter="promql/range_query",severity="bug"}
103-
pint_problem{filename="rules/2.yml",kind="alerting",name="comparison",owner="bob and alice",problem="Couldn't run \"promql/rate\" checks due to `prom1` Prometheus server at http://127.0.0.1:7054 connection error: `server_error: 500 Internal Server Error`.",reporter="promql/rate",severity="bug"}
104-
pint_problem{filename="rules/2.yml",kind="alerting",name="comparison",owner="bob and alice",problem="Couldn't run \"promql/rate\" checks due to `prom2` Prometheus server at http://127.0.0.1:1054 connection error: `connection refused`.",reporter="promql/rate",severity="bug"}
105-
pint_problem{filename="rules/2.yml",kind="alerting",name="comparison",owner="bob and alice",problem="Couldn't run \"promql/series\" checks due to `prom2` Prometheus server at http://127.0.0.1:1054 connection error: `connection refused`.",reporter="promql/series",severity="bug"}
100+
pint_problem{filename="rules/2.yml",kind="alerting",name="comparison",owner="bob and alice",problem="Couldn't run `alerts/external_labels` checks due to `prom1` Prometheus server at http://127.0.0.1:7054 connection error: `server_error: 500 Internal Server Error`.",reporter="alerts/external_labels",severity="bug"}
101+
pint_problem{filename="rules/2.yml",kind="alerting",name="comparison",owner="bob and alice",problem="Couldn't run `alerts/external_labels` checks due to `prom2` Prometheus server at http://127.0.0.1:1054 connection error: `connection refused`.",reporter="alerts/external_labels",severity="bug"}
102+
pint_problem{filename="rules/2.yml",kind="alerting",name="comparison",owner="bob and alice",problem="Couldn't run `promql/range_query` checks due to `prom2` Prometheus server at http://127.0.0.1:1054 connection error: `connection refused`.",reporter="promql/range_query",severity="bug"}
103+
pint_problem{filename="rules/2.yml",kind="alerting",name="comparison",owner="bob and alice",problem="Couldn't run `promql/rate` checks due to `prom1` Prometheus server at http://127.0.0.1:7054 connection error: `server_error: 500 Internal Server Error`.",reporter="promql/rate",severity="bug"}
104+
pint_problem{filename="rules/2.yml",kind="alerting",name="comparison",owner="bob and alice",problem="Couldn't run `promql/rate` checks due to `prom2` Prometheus server at http://127.0.0.1:1054 connection error: `connection refused`.",reporter="promql/rate",severity="bug"}
105+
pint_problem{filename="rules/2.yml",kind="alerting",name="comparison",owner="bob and alice",problem="Couldn't run `promql/series` checks due to `prom2` Prometheus server at http://127.0.0.1:1054 connection error: `connection refused`.",reporter="promql/series",severity="bug"}
106106
pint_problem{filename="rules/2.yml",kind="alerting",name="comparison",owner="bob and alice",problem="`prom1` Prometheus server at http://127.0.0.1:7054 failed with: `bad_data: bogus query`.",reporter="promql/series",severity="bug"}
107107
# HELP pint_problems Total number of problems reported by pint
108108
# TYPE pint_problems gauge

cmd/pint/tests/0108_rule_duplicate.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ rules/0001.yml:1-2 Bug: Duplicated rule, identical rule found at rules/0002.yml:
1616
1 | - record: "colo:duplicate"
1717
2 | expr: sum(foo) without(job)
1818

19-
rules/0001.yml:7-8 Bug: Couldn't run "labels/conflict" checks due to `prom` Prometheus server at http://127.0.0.1:7108 connection error: `connection refused`. (labels/conflict)
19+
rules/0001.yml:7-8 Bug: Couldn't run `labels/conflict` checks due to `prom` Prometheus server at http://127.0.0.1:7108 connection error: `connection refused`. (labels/conflict)
2020
7 | labels:
2121
8 | file: a
2222

@@ -26,19 +26,19 @@ rules/0001.yml:9-12 Bug: Duplicated rule, identical rule found at rules/0002.yml
2626
11 | labels:
2727
12 | same: yes
2828

29-
rules/0001.yml:11-12 Bug: Couldn't run "labels/conflict" checks due to `prom` Prometheus server at http://127.0.0.1:7108 connection error: `connection refused`. (labels/conflict)
29+
rules/0001.yml:11-12 Bug: Couldn't run `labels/conflict` checks due to `prom` Prometheus server at http://127.0.0.1:7108 connection error: `connection refused`. (labels/conflict)
3030
11 | labels:
3131
12 | same: yes
3232

33-
rules/0002.yml:5-6 Bug: Couldn't run "labels/conflict" checks due to `prom` Prometheus server at http://127.0.0.1:7108 connection error: `connection refused`. (labels/conflict)
33+
rules/0002.yml:5-6 Bug: Couldn't run `labels/conflict` checks due to `prom` Prometheus server at http://127.0.0.1:7108 connection error: `connection refused`. (labels/conflict)
3434
5 | labels:
3535
6 | empty: nope
3636

37-
rules/0002.yml:9-10 Bug: Couldn't run "labels/conflict" checks due to `prom` Prometheus server at http://127.0.0.1:7108 connection error: `connection refused`. (labels/conflict)
37+
rules/0002.yml:9-10 Bug: Couldn't run `labels/conflict` checks due to `prom` Prometheus server at http://127.0.0.1:7108 connection error: `connection refused`. (labels/conflict)
3838
9 | labels:
3939
10 | file: b
4040

41-
rules/0002.yml:13-14 Bug: Couldn't run "labels/conflict" checks due to `prom` Prometheus server at http://127.0.0.1:7108 connection error: `connection refused`. (labels/conflict)
41+
rules/0002.yml:13-14 Bug: Couldn't run `labels/conflict` checks due to `prom` Prometheus server at http://127.0.0.1:7108 connection error: `connection refused`. (labels/conflict)
4242
13 | labels:
4343
14 | same: yes
4444

cmd/pint/tests/0115_file_disable_tag.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ level=DEBUG msg="Configured checks for rule" enabled=["promql/syntax","alerts/fo
1717
level=DEBUG msg="Scheduling Prometheus metrics metadata query" uri=http://127.0.0.1:7103 metric=foo
1818
level=DEBUG msg="Getting prometheus metrics metadata" uri=http://127.0.0.1:7103 metric=foo
1919
level=ERROR msg="Query returned an error" err="failed to query Prometheus metrics metadata: Get \"http://127.0.0.1:7103/api/v1/metadata?metric=foo\": dial tcp 127.0.0.1:7103: connect: connection refused" uri=http://127.0.0.1:7103 query=foo
20-
rules/0001.yml:8 Warning: Couldn't run "promql/counter" checks due to `prom` Prometheus server at http://127.0.0.1:7103 connection error: `connection refused`. (promql/counter)
20+
rules/0001.yml:8 Warning: Couldn't run `promql/counter` checks due to `prom` Prometheus server at http://127.0.0.1:7103 connection error: `connection refused`. (promql/counter)
2121
8 | expr: sum(foo) without(job)
2222

2323
level=INFO msg="Problems found" Warning=1

internal/checks/base.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,13 +149,13 @@ func textAndSeverityFromError(err error, reporter, prom string, s Severity) (tex
149149

150150
switch {
151151
case promapi.IsUnsupportedError(err):
152-
text = fmt.Sprintf("Couldn't run %q checks on %s because it's %s.", reporter, promDesc, err)
152+
text = fmt.Sprintf("Couldn't run `%s` checks on %s because it's %s.", reporter, promDesc, err)
153153
severity = Warning
154154
case promapi.IsQueryTooExpensive(err):
155-
text = fmt.Sprintf("Couldn't run %q checks on %s because some queries are too expensive: `%s`.", reporter, promDesc, err)
155+
text = fmt.Sprintf("Couldn't run `%s` checks on %s because some queries are too expensive: `%s`.", reporter, promDesc, err)
156156
severity = Warning
157157
case promapi.IsUnavailableError(err):
158-
text = fmt.Sprintf("Couldn't run %q checks due to %s connection error: `%s`.", reporter, promDesc, err)
158+
text = fmt.Sprintf("Couldn't run `%s` checks due to %s connection error: `%s`.", reporter, promDesc, err)
159159
severity = Warning
160160
if perrOk && perr.IsStrict() {
161161
severity = Bug

internal/checks/base_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -590,13 +590,13 @@ func checkErrorBadData(name, uri, err string) string {
590590
}
591591

592592
func checkErrorUnableToRun(c, name, uri, err string) string {
593-
return fmt.Sprintf("Couldn't run %q checks due to `%s` Prometheus server at %s connection error: `%s`.", c, name, uri, err)
593+
return fmt.Sprintf("Couldn't run `%s` checks due to `%s` Prometheus server at %s connection error: `%s`.", c, name, uri, err)
594594
}
595595

596596
func checkErrorTooExpensiveToRun(c, name, uri, err string) string {
597-
return fmt.Sprintf("Couldn't run %q checks on `%s` Prometheus server at %s because some queries are too expensive: `%s`.", c, name, uri, err)
597+
return fmt.Sprintf("Couldn't run `%s` checks on `%s` Prometheus server at %s because some queries are too expensive: `%s`.", c, name, uri, err)
598598
}
599599

600600
func checkUnsupported(c, name, uri, path string) string {
601-
return fmt.Sprintf("Couldn't run %q checks on `%s` Prometheus server at %s because it's unsupported: this server doesn't seem to support `%s` API endpoint.", c, name, uri, path)
601+
return fmt.Sprintf("Couldn't run `%s` checks on `%s` Prometheus server at %s because it's unsupported: this server doesn't seem to support `%s` API endpoint.", c, name, uri, path)
602602
}

0 commit comments

Comments
 (0)