Skip to content

Replace deprecated model.NameValidationScheme with explicit UTF8Validation#2051

Merged
bwplotka merged 2 commits into
prometheus:mainfrom
kakkoyun:kakkoyun/use-utf8-validation
Jul 8, 2026
Merged

Replace deprecated model.NameValidationScheme with explicit UTF8Validation#2051
bwplotka merged 2 commits into
prometheus:mainfrom
kakkoyun:kakkoyun/use-utf8-validation

Conversation

@kakkoyun

@kakkoyun kakkoyun commented Jul 8, 2026

Copy link
Copy Markdown
Member

model.NameValidationScheme is deprecated in prometheus/common. staticcheck flags each use, and under some golangci-lint cache states the suppressing //nolint directives are themselves reported as unused, which makes lint flaky.

This replaces the three uses (desc.go, labels.go, push/push.go) with the explicit model.UTF8Validation scheme and removes the //nolint directives.

NameValidationScheme already defaults to UTF8Validation, so default behavior is unchanged. Users who set it to LegacyValidation no longer get that enforcement at metric/label/grouping construction; UTF-8 validation is more permissive, so no name that validates today starts failing.

Test plan: go test -race ./prometheus/... ./prometheus/push/... passes and golangci-lint run is clean.

kakkoyun added 2 commits July 8, 2026 15:29
…ameValidationScheme

model.NameValidationScheme is deprecated in prometheus/common. Replace its three uses (desc.go, labels.go, push/push.go) with the explicit model.UTF8Validation scheme and drop the now-unneeded //nolint:staticcheck directives. The global already defaults to UTF8Validation, so default validation behavior is unchanged; setups that set it to LegacyValidation no longer have that enforced at construction, and UTF-8 validation is more permissive, so no currently-valid name starts failing.

Signed-off-by: Kemal Akkoyun <kemal.akkoyun@datadoghq.com>
Signed-off-by: Kemal Akkoyun <kemal.akkoyun@datadoghq.com>
Comment thread CHANGELOG.md
@bwplotka bwplotka merged commit b0d896b into prometheus:main Jul 8, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants