Skip to content

Commit

Permalink
require both a feature flag and a globalconfig flag
Browse files Browse the repository at this point in the history
  • Loading branch information
ywwg committed Jan 5, 2024
1 parent 894093b commit b4dd9d9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 1 addition & 2 deletions cmd/prometheus/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down
3 changes: 3 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,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
}

Expand Down

0 comments on commit b4dd9d9

Please sign in to comment.