Add ValidationScheme methods IsValidMetricName and IsValidLabelName#806
Merged
Add ValidationScheme methods IsValidMetricName and IsValidLabelName#806
ValidationScheme methods IsValidMetricName and IsValidLabelName#806Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR introduces new validation methods to the ValidationScheme type to replace existing deprecated metric and label name validation functions. The changes provide a more consistent and structured approach to validation while maintaining backward compatibility.
- Adds
IsValidMetricNameandIsValidLabelNamemethods toValidationSchemetype - Deprecates existing global validation functions and methods
- Updates test suites to use new validation methods while preserving tests for deprecated functions
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| model/metric.go | Adds new IsValidMetricName and IsValidLabelName methods to ValidationScheme, deprecates existing functions |
| model/labels.go | Deprecates existing LabelName validation methods and delegates to new ValidationScheme methods |
| model/metric_test.go | Updates test to use new validation methods and adds comprehensive testing for both new and deprecated functions |
| model/labels_test.go | Updates test to use new validation methods and adds comprehensive testing for both new and deprecated functions |
| expfmt/text_create.go | Updates calls to use new LegacyValidation.IsValidMetricName method |
| expfmt/openmetrics_create.go | Updates calls to use new LegacyValidation.IsValidMetricName method |
| expfmt/decode.go | Adds static check comments to suppress deprecation warnings |
Signed-off-by: Arve Knudsen <[email protected]>
4514226 to
6caa6cc
Compare
ywwg
reviewed
Jul 31, 2025
Member
ywwg
left a comment
There was a problem hiding this comment.
thanks for this! just one nit that copilot found -- will approve when you mark this as ready for review
Signed-off-by: Arve Knudsen <[email protected]>
Signed-off-by: Arve Knudsen <[email protected]>
Signed-off-by: Arve Knudsen <[email protected]>
Signed-off-by: Arve Knudsen <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add
ValidationSchememethodIsValidMetricNameto replacemodel.IsValidMetricNameandIsValidLegacyMetricName, andValidationSchememethodIsValidMetricNameto replacemodel.LabelName.IsValidandmodel.LabelName.IsValidLegacy. The replaces functions are marked as deprecated, so to phase out dependency on themodel.NameValidationSchemeglobal.