require both a feature flag and a globalconfig flag

This commit is contained in:
Owen Williams 2024-01-05 14:47:19 -05:00
parent 644e4c273c
commit 41224d66e5
2 changed files with 4 additions and 2 deletions

View file

@ -216,9 +216,8 @@ func (c *flagConfig) setFeatureListOptions(logger log.Logger) error {
config.DefaultGlobalConfig.ScrapeProtocols = config.DefaultProtoFirstScrapeProtocols
level.Info(logger).Log("msg", "Experimental created timestamp zero ingestion enabled. Changed default scrape_protocols to prefer PrometheusProto format.", "global.scrape_protocols", fmt.Sprintf("%v", config.DefaultGlobalConfig.ScrapeProtocols))
case "utf8-names":
config.DefaultConfig.GlobalConfig.AllowUTF8Names = true
config.DefaultGlobalConfig.AllowUTF8Names = true
model.NameValidationScheme = model.UTF8Validation
level.Info(logger).Log("msg", "Experimental utf8 support enabled")
case "":
continue
case "promql-at-modifier", "promql-negative-offset":

View file

@ -731,6 +731,9 @@ func (c *ScrapeConfig) Validate(globalConfig GlobalConfig) error {
}
if globalConfig.AllowUTF8Names {
if model.NameValidationScheme != model.UTF8Validation {
return fmt.Errorf("utf8 name support requested but feature not enabled via --enable-feature=utf8-names")
}
c.AllowUTF8Names = true
}