Skip to content

Commit

Permalink
Merge pull request #1240 from cloudflare/paths
Browse files Browse the repository at this point in the history
Add docs around absolute paths
  • Loading branch information
prymitive authored Jan 3, 2025
2 parents 556ecc4 + 29ed4c2 commit 1f8f627
Show file tree
Hide file tree
Showing 114 changed files with 200 additions and 27 deletions.
10 changes: 2 additions & 8 deletions cmd/pint/lint.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,7 @@ func verifyOwners(entries []discovery.Entry, allowedOwners []*regexp.Regexp) (re
}
if entry.Owner == "" {
reports = append(reports, reporter.Report{
Path: discovery.Path{
Name: entry.Path.Name,
SymlinkTarget: entry.Path.SymlinkTarget,
},
Path: entry.Path,
ModifiedLines: entry.ModifiedLines,
Rule: entry.Rule,
Problem: checks.Problem{
Expand All @@ -211,10 +208,7 @@ func verifyOwners(entries []discovery.Entry, allowedOwners []*regexp.Regexp) (re
}
}
reports = append(reports, reporter.Report{
Path: discovery.Path{
Name: entry.Path.Name,
SymlinkTarget: entry.Path.SymlinkTarget,
},
Path: entry.Path,
ModifiedLines: entry.ModifiedLines,
Rule: entry.Rule,
Problem: checks.Problem{
Expand Down
6 changes: 2 additions & 4 deletions cmd/pint/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
)

func checkRules(ctx context.Context, workers int, isOffline bool, gen *config.PrometheusGenerator, cfg config.Config, entries []discovery.Entry) (summary reporter.Summary, err error) {
slog.Info("Checking Prometheus rules", slog.Int("entries", len(entries)), slog.Int("workers", workers), slog.Bool("online", !isOffline))
if isOffline {
slog.Info("Offline mode, skipping Prometheus discovery")
} else {
Expand Down Expand Up @@ -153,10 +154,7 @@ func scanWorker(ctx context.Context, jobs <-chan scanJob, results chan<- reporte
checkDuration.WithLabelValues(job.check.Reporter()).Observe(time.Since(start).Seconds())
for _, problem := range problems {
results <- reporter.Report{
Path: discovery.Path{
Name: job.entry.Path.Name,
SymlinkTarget: job.entry.Path.SymlinkTarget,
},
Path: job.entry.Path,
ModifiedLines: job.entry.ModifiedLines,
Rule: job.entry.Rule,
Problem: problem,
Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0001_match_path.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ cmp stderr stderr.txt
-- stderr.txt --
level=INFO msg="Loading configuration file" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=INFO msg="Checking Prometheus rules" entries=2 workers=10 online=true
rules/0002.yml:2 Bug: `job` label is required and should be preserved when aggregating `^.+$` rules, remove job from `without()`. (promql/aggregate)
2 | expr: sum(foo) without(job)

Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0003_lint_workdir.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ cmp stderr stderr.txt
-- stderr.txt --
level=INFO msg="Loading configuration file" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=INFO msg="Checking Prometheus rules" entries=17 workers=10 online=true
rules/0001.yml:2 Warning: `job` label is required and should be preserved when aggregating `^.+$` rules, remove job from `without()`. (promql/aggregate)
2 | expr: sum(rate(fl_cf_html_bytes_in[10m])) WITHOUT (colo_id, instance, node_type, region, node_status, job, colo_name)

Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0004_fail_invalid_yaml.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ cmp stderr stderr.txt
level=INFO msg="Loading configuration file" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=WARN msg="Failed to parse file content" err="error at line 4: did not find expected key" path=rules/bad.yaml lines=1-7
level=INFO msg="Checking Prometheus rules" entries=2 workers=10 online=true
rules/bad.yaml:4 Fatal: did not find expected key (yaml/parse)
4 |

Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0005_false_positive.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ cmp stderr stderr.txt
-- stderr.txt --
level=INFO msg="Loading configuration file" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=INFO msg="Checking Prometheus rules" entries=2 workers=10 online=true
-- rules/0001.yml --
- record: "colo:test1"
expr: topk(6, sum(rate(edgeworker_subrequest_errorCount{cordon="free"}[5m])) BY (zoneId,job))
Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0006_rr_labels.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ cmp stderr stderr.txt
-- stderr.txt --
level=INFO msg="Loading configuration file" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=INFO msg="Checking Prometheus rules" entries=2 workers=10 online=true
rules/0001.yml:8 Fatal: This rule is not a valid Prometheus rule: `incomplete rule, no alert or record key`. (yaml/parse)
8 | - expr: sum(foo)

Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0007_alerts.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ cmp stderr stderr.txt
-- stderr.txt --
level=INFO msg="Loading configuration file" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=INFO msg="Checking Prometheus rules" entries=6 workers=10 online=true
rules/0001.yml:1-2 Warning: `severity` label is required. (rule/label)
1 | - alert: Always
2 | expr: up
Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0008_recording_rule_prometheus.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ cmp stderr stderr.txt
-- stderr.txt --
level=INFO msg="Loading configuration file" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=INFO msg="Checking Prometheus rules" entries=1 workers=10 online=true
rules/0001.yml:5 Warning: `job` label is required and should be preserved when aggregating `^.+$` rules, use `by(job, ...)`. (promql/aggregate)
5 | expr: sum by (instance) (http_inprogress_requests)

Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0009_alerting_rule_prometheus.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ cmp stderr stderr.txt
-- stderr.txt --
level=INFO msg="Loading configuration file" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=INFO msg="Checking Prometheus rules" entries=2 workers=10 online=true
rules/0001.yml:11-13 Bug: `link` annotation is required. (alerts/annotation)
11 | annotations:
12 | summary: "Instance {{ $labels.instance }} down"
Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0010_syntax_check.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ cmp stderr stderr.txt
level=INFO msg="Loading configuration file" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=WARN msg="Failed to parse file content" err="error at line 6: did not find expected '-' indicator" path=rules/1.yaml lines=1-12
level=INFO msg="Checking Prometheus rules" entries=1 workers=10 online=true
rules/1.yaml:6 Fatal: did not find expected '-' indicator (yaml/parse)
6 |

Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0011_ignore_rules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ cmp stderr stderr.txt
-- stderr.txt --
level=INFO msg="Loading configuration file" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=INFO msg="Checking Prometheus rules" entries=10 workers=10 online=true
rules/1.yaml:5 Fatal: Prometheus failed to parse the query with this PromQL error: unexpected right parenthesis ')'. (promql/syntax)
5 | expr: sum(errors_total) by )

Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0012_issue_20.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ cmp stderr stderr.txt
-- stderr.txt --
level=INFO msg="Loading configuration file" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=INFO msg="Checking Prometheus rules" entries=1 workers=10 online=true
level=WARN msg="Tried to read more lines than present in the source file, this is likely due to '
' usage in some rules, see https://github.com/cloudflare/pint/issues/20 for details" path=rules/1.yaml
rules/1.yaml:9-13 Warning: `runbook_url` annotation is required. (alerts/annotation)
Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0014_issue49_2.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ cmp stderr stderr.txt
-- stderr.txt --
level=INFO msg="Loading configuration file" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=INFO msg="Checking Prometheus rules" entries=1 workers=10 online=true
-- rules/0001.yaml --
- record: down
expr: up == 0
Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0018_match_alerting.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ level=DEBUG msg="Adding pint config to the parser exclude list" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=DEBUG msg="File parsed" path=rules/0001.yml rules=2
level=DEBUG msg="Glob finder completed" count=2
level=INFO msg="Checking Prometheus rules" entries=2 workers=10 online=true
level=DEBUG msg="Generated all Prometheus servers" count=0
level=DEBUG msg="Found recording rule" path=rules/0001.yml record=colo:recording lines=1-2 state=noop
level=DEBUG msg="Configured checks for rule" enabled=["promql/syntax","alerts/for","alerts/comparison","alerts/template","promql/fragile","promql/regexp"] path=rules/0001.yml rule=colo:recording
Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0019_match_recording.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ level=DEBUG msg="Adding pint config to the parser exclude list" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=DEBUG msg="File parsed" path=rules/0001.yml rules=2
level=DEBUG msg="Glob finder completed" count=2
level=INFO msg="Checking Prometheus rules" entries=2 workers=10 online=true
level=DEBUG msg="Generated all Prometheus servers" count=0
level=DEBUG msg="Found recording rule" path=rules/0001.yml record=colo:recording lines=1-2 state=noop
level=DEBUG msg="Configured checks for rule" enabled=["promql/syntax","alerts/for","alerts/comparison","alerts/template","promql/fragile","promql/regexp","promql/aggregate(job:true)"] path=rules/0001.yml rule=colo:recording
Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0020_ignore_kind.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ level=DEBUG msg="Adding pint config to the parser exclude list" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=DEBUG msg="File parsed" path=rules/0001.yml rules=2
level=DEBUG msg="Glob finder completed" count=2
level=INFO msg="Checking Prometheus rules" entries=2 workers=10 online=true
level=DEBUG msg="Generated all Prometheus servers" count=0
level=DEBUG msg="Found recording rule" path=rules/0001.yml record=colo:recording lines=4-5 state=noop
level=DEBUG msg="Configured checks for rule" enabled=["promql/syntax","alerts/for","alerts/comparison","alerts/template","promql/fragile","promql/regexp","promql/aggregate(job:true)"] path=rules/0001.yml rule=colo:recording
Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0022_ignore_multi.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ cmp stderr stderr.txt
-- stderr.txt --
level=INFO msg="Loading configuration file" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=INFO msg="Checking Prometheus rules" entries=3 workers=10 online=true
rules/1.yaml:2 Warning: `dropped` label should be removed when aggregating `^.+$` rules, remove dropped from `by()`. (promql/aggregate)
2 | expr: sum(errors_total) by(keep,dropped)

Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0024_color_output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ cmp stderr stderr.txt
-- stderr.txt --
level=INFO msg="Loading configuration file" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=INFO msg="Checking Prometheus rules" entries=14 workers=10 online=true
rules/0001.yml:2 Warning: `job` label is required and should be preserved when aggregating `^.+$` rules, remove job from `without()`. (promql/aggregate)
 2 | expr: sum(rate(fl_cf_html_bytes_in[10m])) WITHOUT (colo_id, instance, node_type, region, node_status, job, colo_name)

Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0027_ci_branch.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ cmp stderr ../stderr.txt
-- stderr.txt --
level=INFO msg="Loading configuration file" path=.pint.hcl
level=INFO msg="Finding all rules to check on current git branch" base=main
level=INFO msg="Checking Prometheus rules" entries=2 workers=10 online=true
level=INFO msg="Problems found" Fatal=1
rules.yml:2 Fatal: Prometheus failed to parse the query with this PromQL error: unexpected identifier "bi". (promql/syntax)
2 | expr: sum(foo) bi(job)
Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0037_disable_checks.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ level=DEBUG msg="File parsed" path=rules/0001.yml rules=3
level=DEBUG msg="Glob finder completed" count=3
level=INFO msg="Configured new Prometheus server" name=prom uris=1 uptime=up tags=[] include=[] exclude=[]
level=DEBUG msg="Starting query workers" name=prom uri=http://127.0.0.1 workers=16
level=INFO msg="Checking Prometheus rules" entries=3 workers=10 online=true
level=DEBUG msg="Generated all Prometheus servers" count=1
level=DEBUG msg="Found alerting rule" path=rules/0001.yml alert=default-for lines=1-3 state=noop
level=DEBUG msg="Configured checks for rule" enabled=["promql/syntax","alerts/template","promql/fragile","promql/regexp","promql/vector_matching(prom)","rule/duplicate(prom)","labels/conflict(prom)","alerts/absent(prom)"] path=rules/0001.yml rule=default-for
Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0038_disable_checks_regex.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ cmp stderr stderr.txt
-- stderr.txt --
level=INFO msg="Loading configuration file" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=INFO msg="Checking Prometheus rules" entries=3 workers=10 online=true
rules/0001.yml:6 Warning: `job` label is required and should be preserved when aggregating `^.+$` rules, use `by(job, ...)`. (promql/aggregate)
6 | expr: sum(foo)

Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0039_prom_selected_path.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ level=DEBUG msg="File parsed" path=rules/0001.yml rules=3
level=DEBUG msg="Glob finder completed" count=3
level=INFO msg="Configured new Prometheus server" name=disabled uris=1 uptime=up tags=[] include=["^invalid/.+$"] exclude=["^invalid/rules/.+$"]
level=DEBUG msg="Starting query workers" name=disabled uri=http://127.0.0.1:123 workers=16
level=INFO msg="Checking Prometheus rules" entries=3 workers=10 online=true
level=DEBUG msg="Generated all Prometheus servers" count=1
level=DEBUG msg="Found alerting rule" path=rules/0001.yml alert=first lines=1-3 state=noop
level=DEBUG msg="Configured checks for rule" enabled=["promql/syntax","alerts/for","alerts/comparison","alerts/template","promql/fragile","promql/regexp"] path=rules/0001.yml rule=first
Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0040_rule_match_label.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ level=DEBUG msg="Adding pint config to the parser exclude list" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=DEBUG msg="File parsed" path=rules/rules.yml rules=4
level=DEBUG msg="Glob finder completed" count=4
level=INFO msg="Checking Prometheus rules" entries=4 workers=10 online=true
level=DEBUG msg="Generated all Prometheus servers" count=0
level=DEBUG msg="Found recording rule" path=rules/rules.yml record=ignore lines=1-2 state=noop
level=DEBUG msg="Configured checks for rule" enabled=["promql/syntax","alerts/for","alerts/comparison","alerts/template","promql/fragile","promql/regexp"] path=rules/rules.yml rule=ignore
Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0052_match_multiple.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ level=DEBUG msg="Adding pint config to the parser exclude list" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=DEBUG msg="File parsed" path=rules/0001.yml rules=2
level=DEBUG msg="Glob finder completed" count=2
level=INFO msg="Checking Prometheus rules" entries=2 workers=10 online=true
level=DEBUG msg="Generated all Prometheus servers" count=0
level=DEBUG msg="Found recording rule" path=rules/0001.yml record=colo:recording lines=4-5 state=noop
level=DEBUG msg="Configured checks for rule" enabled=["promql/syntax","alerts/for","alerts/comparison","alerts/template","promql/fragile","promql/regexp","promql/aggregate(job:true)"] path=rules/0001.yml rule=colo:recording
Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0053_ignore_multiple.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ level=DEBUG msg="Adding pint config to the parser exclude list" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=DEBUG msg="File parsed" path=rules/0001.yml rules=2
level=DEBUG msg="Glob finder completed" count=2
level=INFO msg="Checking Prometheus rules" entries=2 workers=10 online=true
level=DEBUG msg="Generated all Prometheus servers" count=0
level=DEBUG msg="Found recording rule" path=rules/0001.yml record=colo:recording lines=4-5 state=noop
level=DEBUG msg="Configured checks for rule" enabled=["promql/syntax","alerts/for","alerts/comparison","alerts/template","promql/fragile","promql/regexp"] path=rules/0001.yml rule=colo:recording
Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0058_templated_check.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ cmp stderr stderr.txt
-- stderr.txt --
level=INFO msg="Loading configuration file" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=INFO msg="Checking Prometheus rules" entries=3 workers=10 online=true
rules/0001.yml:4-6 Bug: `alert_for` annotation is required. (alerts/annotation)
4 | - alert: Instance Is Down 2
5 | expr: up == 0
Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0060_ci_noop.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ cmp stderr ../stderr.txt
-- stderr.txt --
level=INFO msg="Loading configuration file" path=.pint.hcl
level=INFO msg="Finding all rules to check on current git branch" base=main
level=INFO msg="Checking Prometheus rules" entries=1 workers=10 online=true
level=INFO msg="Problems found" Fatal=1
b.yml:2 Fatal: Prometheus failed to parse the query with this PromQL error: unexpected identifier "bi". (promql/syntax)
2 | expr: sum(foo) bi()
Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0063_lint_offline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ cmp stderr stderr.txt
level=INFO msg="Loading configuration file" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=INFO msg="Configured new Prometheus server" name=disabled uris=1 uptime=up tags=[] include=["^invalid/.+$"] exclude=[]
level=INFO msg="Checking Prometheus rules" entries=1 workers=10 online=false
level=INFO msg="Offline mode, skipping Prometheus discovery"
-- rules/ok.yml --
- record: sum:foo
Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0066_lint_owner.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ cmp stderr stderr.txt
-- stderr.txt --
level=INFO msg="Loading configuration file" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=INFO msg="Checking Prometheus rules" entries=5 workers=10 online=true
rules/1.yml:4-5 Bug: `rule/owner` comments are required in all files, please add a `# pint file/owner $owner` somewhere in this file and/or `# pint rule/owner $owner` on top of each rule. (rule/owner)
4 | - alert: No Owner
5 | expr: up > 0
Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0067_relaxed.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ cmp stderr stderr.txt
level=INFO msg="Loading configuration file" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=WARN msg="Failed to parse file content" err="error at line 2: top level field must be a groups key, got list" path=rules/strict.yml lines=1-4
level=INFO msg="Checking Prometheus rules" entries=2 workers=10 online=true
rules/strict.yml:2 Fatal: top level field must be a groups key, got list (yaml/parse)
2 | - alert: No Owner

Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0073_lint_k8s.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ cmp stderr stderr.txt
-- stderr.txt --
level=INFO msg="Loading configuration file" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=INFO msg="Checking Prometheus rules" entries=4 workers=10 online=true
rules/1.yml:22-23 Bug: `summary` annotation is required. (alerts/annotation)
22 | - alert: Example_High_Restart_Rate
23 | expr: sum(rate(kube_pod_container_status_restarts_total{namespace="example-app"}[5m])) > ( 3/60 )
Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0074_strict_error.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ cmp stderr stderr.txt
-- stderr.txt --
level=INFO msg="Finding all rules to check" paths=["rules"]
level=WARN msg="Failed to parse file content" err="error at line 2: invalid group key alert" path=rules/strict.yml lines=1-9
level=INFO msg="Checking Prometheus rules" entries=1 workers=10 online=true
rules/strict.yml:2 Fatal: invalid group key alert (yaml/parse)
2 | - alert: Conntrack_Table_Almost_Full

Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0077_strict_error_owner.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ cmp stderr stderr.txt

-- stderr.txt --
level=INFO msg="Finding all rules to check" paths=["rules"]
level=INFO msg="Checking Prometheus rules" entries=1 workers=10 online=true
rules/strict.yml:4-7 Bug: `rule/owner` comments are required in all files, please add a `# pint file/owner $owner` somewhere in this file and/or `# pint rule/owner $owner` on top of each rule. (rule/owner)
4 | - alert: foo bar
5 | expr: up == 0
Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0078_repeated_group.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ cmp stderr stderr.txt
-- stderr.txt --
level=INFO msg="Finding all rules to check" paths=["rules"]
level=WARN msg="Failed to parse file content" err="error at line 4: duplicated group name" path=rules/strict.yml lines=1-5
level=INFO msg="Checking Prometheus rules" entries=1 workers=10 online=true
rules/strict.yml:4 Fatal: duplicated group name (yaml/parse)
4 | - name: foo

Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0080_lint_online.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ cmp stderr stderr.txt
level=INFO msg="Loading configuration file" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=INFO msg="Configured new Prometheus server" name=prom1 uris=1 uptime=prometheus_ready tags=[] include=[] exclude=[]
level=INFO msg="Checking Prometheus rules" entries=1 workers=10 online=true
level=WARN msg="No results for Prometheus uptime metric, you might have set uptime config option to a missing metric, please check your config" name=prom1 metric=prometheus_ready
level=WARN msg="Using dummy Prometheus uptime metric results with no gaps" name=prom1 metric=prometheus_ready
rules/1.yml:2 Warning: `http_errors_total[2d]` selector is trying to query Prometheus for 2d worth of metrics, but `prom1` Prometheus server at http://127.0.0.1:7080 is configured to only keep 1d of metrics history. (promql/range_query)
Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0081_rulefmt.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ cmp stderr stderr.txt

-- stderr.txt --
level=INFO msg="Finding all rules to check" paths=["rules"]
level=INFO msg="Checking Prometheus rules" entries=1 workers=10 online=true
rules/strict.yml:4 Fatal: This rule is not a valid Prometheus rule: `missing expr key`. (yaml/parse)
4 | - record: foo

Expand Down
Loading

0 comments on commit 1f8f627

Please sign in to comment.