fix: update prometheus label API usage for prometheus 0.14 - #1081
Open
ayushsingh82 wants to merge 2 commits into
Open
fix: update prometheus label API usage for prometheus 0.14#1081ayushsingh82 wants to merge 2 commits into
ayushsingh82 wants to merge 2 commits into
Conversation
prometheus 0.14 tightened with_label_values/get_metric_with_label_values/ remove_label_values to require a uniform label type across the slice, so mixing &String (from .to_string()) with &str constants no longer type-checks. Normalize all label values to &str via .as_str(). Also replaces the deprecated LabelPair::get_value() with value(), which otherwise fails the workspace clippy -D warnings gate. Fixes the CI compile failures on the pending prometheus 0.14.0 bump (graphprotocol#1027).
Author
|
cc @MoonBoi9001 — same theme as #1080: this one fixes 11 |
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.
Summary
prometheus0.14 tightenedwith_label_values/get_metric_with_label_values/remove_label_valuesto require a single uniform label type across the slice. Several call sites mixed&String(from.to_string()) with&strconstants (TAP_VERSION/TAP_V2) in the same array, which no longer type-checks. This currently breaks CI on the pendingprometheus0.14.0 bump (#1027).Also fixes one
deprecatedwarning (LabelPair::get_value()→.value()) that would otherwise fail the workspace'scargo clippy -D warningsgate once the above compiles.Changes
crates/tap-agent/src/agent/sender_allocation.rs: 4 call sites normalized to&strvia.as_str()crates/tap-agent/src/agent/sender_account.rs: 7 call sites (incl. 3 in tests) normalized the same waycrates/service/src/middleware/prometheus_metrics.rs: replaced deprecatedget_value()withvalue()Test plan
cargo check --workspace --all-targets --all-features— compiles cleancargo clippy --workspace --all-features --all-targets -- -A dead-code -D warnings— clean, matching CI's exact invocationcargo fmt --check— no diffShould unblock #1027 (
prometheus0.14.0) once rebased on top of, or merged alongside, this fix.