-
Notifications
You must be signed in to change notification settings - Fork 338
Add ValidationScheme methods IsValidMetricName and IsValidLabelName
#806
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 <arve.knudsen@gmail.com>
4514226 to
6caa6cc
Compare
ywwg
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for this! just one nit that copilot found -- will approve when you mark this as ready for review
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
ywwg
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for this!
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
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.