Summary
The Prometheus rulefmt.Rule.Validate() method now accepts a model.ValidationScheme parameter that controls whether metric and label names must follow legacy Prometheus naming rules or can be any valid UTF-8 string.
Currently cortex-tools hardcodes model.LegacyValidation. As Cortex and Prometheus adopt UTF-8 metric name support, users should be able to control this.
Proposal
Add a --validation-scheme flag (default legacy) to rule-related commands:
rules check
rules lint
rules load
Accepted values:
legacy — metric/label names must match [a-zA-Z_:][a-zA-Z0-9_:]*
utf8 — only requires valid UTF-8 strings
References
Summary
The Prometheus
rulefmt.Rule.Validate()method now accepts amodel.ValidationSchemeparameter that controls whether metric and label names must follow legacy Prometheus naming rules or can be any valid UTF-8 string.Currently cortex-tools hardcodes
model.LegacyValidation. As Cortex and Prometheus adopt UTF-8 metric name support, users should be able to control this.Proposal
Add a
--validation-schemeflag (defaultlegacy) to rule-related commands:rules checkrules lintrules loadAccepted values:
legacy— metric/label names must match[a-zA-Z_:][a-zA-Z0-9_:]*utf8— only requires valid UTF-8 stringsReferences
model.ValidationSchemeinproxy.fjygbaifeng.eu.org/prometheus/common/modelpkg/rules/rules.goinValidateRuleGroup()