Skip to content

Prometheus not actually validating legacy names when utf8 on globally but overrided in scrapeconfig #14728

@ywwg

Description

@ywwg

When utf8 mode is enabled in prometheus, it can be overridden on a per-scrape config basis. While setting this override does change the content negotiation, the code does not actually validate the names at scrape time. We need to figure out where the name validation is done and then switch validation type depending on the scrapeconfig setting.

There are four places where model.IsValidMetricName is checked:

  1. rulefmt.go: this probably does not need to change, it's a formatter
  2. protobufparse.go: this may also be fine?
  3. codec.go: this is on the query side, so shouldn't be connected to scrape configs
  4. labels_common.go: probably the one that needs to be fixed

part of #13095

We'll need a test to exercise the bug

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions