Commit 83d3d78
committed
fix: raise ValueError when clear() called on metric without labels (#1140)
Metrics without labels never initialize _lock or _metrics (only parent
metrics with labelnames do). Calling clear() on such a metric raised an
unhelpful AttributeError. Guard with the same ValueError pattern that
remove() already uses, matching maintainer guidance that clear() is not
intended for label-less metrics.
Fixes #1140. Also addresses duplicate #949.1 parent 6133347 commit 83d3d78
2 files changed
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
254 | 254 | | |
255 | 255 | | |
256 | 256 | | |
| 257 | + | |
| 258 | + | |
257 | 259 | | |
258 | 260 | | |
259 | 261 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
620 | 620 | | |
621 | 621 | | |
622 | 622 | | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
623 | 629 | | |
624 | 630 | | |
625 | 631 | | |
| |||
0 commit comments