| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
…uteError Fixes prometheus#707. clear() unconditionally acquired self._lock, which is never created for metrics with no labelnames, causing an AttributeError. Per discussion in the issue (csmarchbanks, roidelapluie, sdfordham, tomprince), a label-less metric has no labelsets to clear, so clear() now treats this as a no-op rather than raising. Signed-off-by: Om Pathak <ompathak@gmail.com>
There was a problem hiding this comment.
The change in this PR does not match the description, pushed the wrong change perhaps?
Sorry, something went wrong.
|
I am so sorry about that, a branch mix up on my end (the WSL docs note and this fix ended up on the same branch pointer). Force pushed the corrected commit just now, the diff now shows the clear() change in metrics.py and regression test in test_core.py |
Sorry, something went wrong.
There was a problem hiding this comment.
Thanks!
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Fixes #707.
clear() unconditionally did with self._lock:, but self._lock
is only created in __init__ for metrics with labelnames. Calling
.clear() on a label-less metric (e.g. Counter('c', 'c')) raised
AttributeError: 'Counter' object has no attribute '_lock'.
Per the discussion in the issue, a label-less metric has no
labelsets to clear, so this makes clear() a no-op in that case
rather than raising consistent with the direction @csmarchbanks
and others converged on in the thread.
Added a regression test in tests/test_core.py::TestCounter.
@csmarchbanks would appreciate your review on this when you have a chance.