prometheus / prometheus/client_rust

Clone Family.metrics and iterate over family

Open
#131 4 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
606
Forks
113
Avg merge
9h 7m
Merged PRs (30d)
8

Description

Problems
  1. There is no way to copy/clone the HashMap<S,M> within family.

    • Use case: Storing metrics to compare against later
  2. There is no way to iterate over a metric Family or get metrics without knowing the labels.

    • The only to get all metrics is to manually call get_or_create() for every metric. This isn't great if you don't know the label names (don't store them etc...).

I am happy to tackle these if you want. I think making M clone (not sure why it isn't atm) and returning a new hashmap with the cloned values would fix both these problems.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the Family implementation and its internal HashMap<S,M>, then read the surrounding API and tests. Define and implement cloning of stored metrics and iteration or retrieval without label names; done means both use cases are covered by tests and the public API remains coherent.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
observability-sre
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.