Skip to content

Conversation

@aknuds1
Copy link
Contributor

@aknuds1 aknuds1 commented Jul 28, 2025

Add ValidationScheme method IsValidMetricName to replace model.IsValidMetricName and IsValidLegacyMetricName , and ValidationScheme method IsValidMetricName to replace model.LabelName.IsValid and model.LabelName.IsValidLegacy. The replaces functions are marked as deprecated, so to phase out dependency on the model.NameValidationScheme global.

@aknuds1 aknuds1 requested a review from Copilot July 28, 2025 08:45
Copy link
Contributor

Copilot AI left a 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 IsValidMetricName and IsValidLabelName methods to ValidationScheme type
  • 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>
Copy link
Member

@ywwg ywwg left a 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

aknuds1 added 2 commits July 31, 2025 16:50
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
@aknuds1 aknuds1 marked this pull request as ready for review July 31, 2025 14:56
@aknuds1 aknuds1 requested a review from ywwg July 31, 2025 14:57
Copy link
Member

@ywwg ywwg left a comment

Choose a reason for hiding this comment

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

thanks for this!

aknuds1 added 2 commits August 1, 2025 09:06
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
@aknuds1 aknuds1 merged commit c79a891 into main Aug 1, 2025
9 checks passed
@aknuds1 aknuds1 deleted the arve/validation-methods branch August 1, 2025 07:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants