Skip to content

feat(prometheus): explicit label/metric name validation scheme #1822

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: release-1.22
Choose a base branch
from

Conversation

juliusmh
Copy link

No description provided.

Copy link

@aknuds1 aknuds1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you hard coding model.UTF8Validation in certain places?

@@ -95,7 +95,7 @@ func (v2) NewDesc(fqName, help string, variableLabels ConstrainableLabels, const
help: help,
variableLabels: variableLabels.compile(),
}
if !model.IsValidMetricName(model.LabelValue(fqName)) {
if !model.IsValidMetricName(model.LabelValue(fqName), model.UTF8Validation) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you hard coding model.UTF8Validation here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NewDesc is controlled by us, e.g. we never call it with a customer's metric name. Changing the function signature touches 94 places in Mimir.

Copy link

@aknuds1 aknuds1 Jun 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@juliusmh client_golang isn't just used by Mimir though. Also, hard coding the name validation scheme here is a backwards incompatible change, albeit implicit. I personally think that either the validation scheme should be an explicit argument, or alternatively NewDesc could take variadic options and default to model.UTF8Validation (this would also be backwards incompatible, but at least we avoid hard coding). @ywwg What's your take?

@juliusmh juliusmh force-pushed the remove_global_name_validation branch 2 times, most recently from 5a063ae to 8972161 Compare June 30, 2025 10:22
@juliusmh juliusmh force-pushed the remove_global_name_validation branch from 8972161 to f427c16 Compare June 30, 2025 10:46
@juliusmh juliusmh changed the base branch from main to release-1.22 June 30, 2025 10:47
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