Skip to content

fix: update prometheus label API usage for prometheus 0.14 - #1081

Open
ayushsingh82 wants to merge 2 commits into
graphprotocol:mainfrom
ayushsingh82:fix/prometheus-0-14-labels
Open

fix: update prometheus label API usage for prometheus 0.14#1081
ayushsingh82 wants to merge 2 commits into
graphprotocol:mainfrom
ayushsingh82:fix/prometheus-0-14-labels

Conversation

@ayushsingh82

Copy link
Copy Markdown

Summary

prometheus 0.14 tightened with_label_values / get_metric_with_label_values / remove_label_values to require a single uniform label type across the slice. Several call sites mixed &String (from .to_string()) with &str constants (TAP_VERSION / TAP_V2) in the same array, which no longer type-checks. This currently breaks CI on the pending prometheus 0.14.0 bump (#1027).

Also fixes one deprecated warning (LabelPair::get_value().value()) that would otherwise fail the workspace's cargo clippy -D warnings gate once the above compiles.

Changes

  • crates/tap-agent/src/agent/sender_allocation.rs: 4 call sites normalized to &str via .as_str()
  • crates/tap-agent/src/agent/sender_account.rs: 7 call sites (incl. 3 in tests) normalized the same way
  • crates/service/src/middleware/prometheus_metrics.rs: replaced deprecated get_value() with value()

Test plan

  • cargo check --workspace --all-targets --all-features — compiles clean
  • cargo clippy --workspace --all-features --all-targets -- -A dead-code -D warnings — clean, matching CI's exact invocation
  • cargo fmt --check — no diff

Should unblock #1027 (prometheus 0.14.0) once rebased on top of, or merged alongside, this fix.

renovate Bot and others added 2 commits August 6, 2026 09:37
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).
@ayushsingh82

Copy link
Copy Markdown
Author

cc @MoonBoi9001 — same theme as #1080: this one fixes 11 with_label_values/get_metric_with_label_values/remove_label_values call sites in tap-agent (sender_allocation.rs, sender_account.rs) that mixed &String and &str labels, which prometheus 0.14 no longer allows. Also fixed one deprecated-API warning in indexer-service-rs that would've failed the clippy -D warnings gate. Unblocks the pending prometheus 0.14.0 bump (#1027).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant