Commit 3942d06
authored
feat(metrics/family): 🍭
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 #245, which allows callers to check if a family `contains()` a
given label set.
```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 <git@katelyn.world>len() returns the number of metrics (#246)1 parent bffe835 commit 3942d06
2 files changed
+32
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
| 27 | + | |
25 | 28 | | |
26 | 29 | | |
27 | 30 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
362 | 362 | | |
363 | 363 | | |
364 | 364 | | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
365 | 394 | | |
366 | 395 | | |
367 | 396 | | |
| |||
0 commit comments