Skip to content

Conversation

aknuds1
Copy link
Contributor

@aknuds1 aknuds1 commented Aug 25, 2025

Upgrade to latest prometheus/common:

  • Use the new prometheus/common.expfmt.NewTextParser function for instantiating expfmt.TextParsers, with the now mandatory name validation scheme. Creating TextParsers directly leads to them having an invalid name validation scheme, so it shouldn't be done.
  • Use explicit metric/label name validation schemes, because the implicit variants are deprecated

Copy link

@Copilot 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 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 with expfmt.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.

@aknuds1 aknuds1 force-pushed the arve/text-parser-scheme branch from f46f9cc to 78f5a69 Compare August 25, 2025 08:43
@aknuds1 aknuds1 force-pushed the arve/text-parser-scheme branch from 78f5a69 to 77164b6 Compare August 25, 2025 08:45
@aknuds1 aknuds1 requested a review from Copilot August 25, 2025 08:51
Copilot

This comment was marked as outdated.

@aknuds1 aknuds1 requested a review from Copilot August 25, 2025 09:03
Copy link

@Copilot 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 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 direct TextParser 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.

Copy link
Contributor

@vesari vesari left a comment

Choose a reason for hiding this comment

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

LGTM

@aknuds1 aknuds1 merged commit 2d1f151 into main Aug 25, 2025
9 checks passed
@aknuds1 aknuds1 deleted the arve/text-parser-scheme branch August 25, 2025 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants