Skip to content
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

feat(metrics/family): 🍭 len() returns the number of metrics #246

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Commits on Nov 18, 2024

  1. feat(metrics/family): len() returns the number of metrics

    this commit introduces a `len()` method to `Family<S, M, C>`, which
    returns the number of series within a metric family.
    
    see also prometheus#245, which allows callers to check if a family `contains()` a
    given label set.
    
    Signed-off-by: katelyn martin <[email protected]>
    cratelyn committed Nov 18, 2024
    Configuration menu
    Copy the full SHA
    27a2e49 View commit details
    Browse the repository at this point in the history

Commits on Nov 19, 2024

  1. lint(metrics/family): add is_empty()

    ```shell
    $ cargo clippy --all-features --all-targets --tests
       Compiling prometheus-client v0.23.0 (/path/to/prometheus-client)
    warning: struct `Family` has a public `len` method, but no `is_empty` method
       --> src/metrics/family.rs:309:5
        |
    309 |     pub fn len(&self) -> usize {
        |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_without_is_empty
        = note: `#[warn(clippy::len_without_is_empty)]` on by default
    
    warning: `prometheus-client` (lib) generated 1 warning
    warning: `prometheus-client` (lib test) generated 1 warning (1 duplicate)
        Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.63s
    ```
    
    Signed-off-by: katelyn martin <[email protected]>
    cratelyn committed Nov 19, 2024
    Configuration menu
    Copy the full SHA
    c301225 View commit details
    Browse the repository at this point in the history