-
Notifications
You must be signed in to change notification settings - Fork 60
Open
Description
Hello! I believe the yaml/parse check is incorrectly identifying labels with integer values as invalid Prometheus rules. I've found Prometheus parses the integer label values just fine into a string.
❯ pint version
0.75.0 (revision: 8d7858af608e8c6ebe991b1ca3c1513409970343)
❯ pint lint --min-severity=bug prometheus_recording_rules.yaml
level=INFO msg="Finding all rules to check" paths=["prometheus_recording_rules.yaml"]
level=INFO msg="Checking Prometheus rules" entries=56 workers=10 online=true
Fatal: This rule is not a valid Prometheus rule: `labels dc_id value must be a string, got integer instead`. (yaml/parse)
---> prometheus_recording_rules.yaml:9
9 | dc_id: 55
^^^ This rule is not a valid Prometheus rule: `labels dc_id value must be a string, got integer instead`.
level=INFO msg="Problems found" Fatal=1
level=ERROR msg="Execution completed with error(s)" err="found 1 problem(s) with severity Bug or higher"However in practice, Prometheus parses the integer value into the label value:
datacenter_info{dc_id="55"}
I couldn't find any upstream docs on if a string is mandated though:
I tried tracking down the upstream code for the rule YAML parsing and got to around here:
- https://github.com/prometheus/prometheus/blob/main/model/rulefmt/rulefmt.go#L340C1-L368C2
- https://github.com/prometheus/prometheus/blob/main/model/rulefmt/rulefmt.go#L370-L381
I believe Pint's yaml parsing here is stricter than Prometheus'. We've been using this pattern with various Prometheus versions from 2 to 3+.
Metadata
Metadata
Assignees
Labels
No labels