-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Use prometheus/common.expfmt.NewTextParser #1859
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
Signed-off-by: Arve Knudsen <[email protected]>
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 updates the codebase to use the new prometheus/common.expfmt.NewTextParser
constructor function instead of directly instantiating expfmt.TextParser
structs, adding the required UTF8 validation scheme parameter.
- Replace direct
expfmt.TextParser
instantiation withexpfmt.NewTextParser(model.UTF8Validation)
calls - Add required import for
prometheus/common/model
package - Update dependencies to support the new API
Reviewed Changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.
File | Description |
---|---|
prometheus/testutil/testutil.go | Replace zero-value TextParser with NewTextParser constructor |
prometheus/examples_test.go | Replace zero-value TextParser with NewTextParser constructor and add model import |
go.mod | Update prometheus/common dependency to version supporting new API |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
f46f9cc
to
78f5a69
Compare
Signed-off-by: Arve Knudsen <[email protected]>
78f5a69
to
77164b6
Compare
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 upgrades to the latest prometheus/common library and addresses deprecation warnings by migrating to the new explicit API patterns. The changes modernize the codebase to use the latest prometheus library standards while maintaining functionality.
- Replace deprecated implicit validation schemes with explicit validation schemes
- Use the new
NewTextParser
function instead of directTextParser
instantiation - Update dependency versions to latest prometheus/common
Reviewed Changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
prometheus/testutil/testutil.go | Updates TextParser instantiation to use NewTextParser with UTF8Validation |
prometheus/push/push.go | Replaces deprecated LabelName.IsValid() with explicit NameValidationScheme |
prometheus/labels.go | Migrates from deprecated LabelName.IsValid() to explicit validation scheme |
prometheus/internal/go_runtime_metrics.go | Updates legacy metric name validation to use explicit LegacyValidation scheme |
prometheus/examples_test.go | Adds model import and uses NewTextParser with UTF8Validation |
prometheus/desc.go | Replaces deprecated IsValidMetricName with explicit NameValidationScheme |
go.mod | Updates prometheus/common and related dependencies to latest versions |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
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.
LGTM
Upgrade to latest prometheus/common:
prometheus/common.expfmt.NewTextParser
function for instantiatingexpfmt.TextParser
s, with the now mandatory name validation scheme. CreatingTextParser
s directly leads to them having an invalid name validation scheme, so it shouldn't be done.