mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-13 00:10:03 +00:00
Use a helper to query monitor counters
This commit is contained in:
parent
47f9147e16
commit
c3440ce213
@ -457,31 +457,32 @@ class DeepCheckResultsRendererElement(Element, ResultsBase, ReloadMixin):
|
|||||||
super(DeepCheckResultsRendererElement, self).__init__()
|
super(DeepCheckResultsRendererElement, self).__init__()
|
||||||
self.monitor = monitor
|
self.monitor = monitor
|
||||||
|
|
||||||
# TODO: Add a helper to query monitor.get_status.get_counters()
|
|
||||||
|
|
||||||
@renderer
|
@renderer
|
||||||
def root_storage_index(self, req, tag):
|
def root_storage_index(self, req, tag):
|
||||||
return self.monitor.get_status().get_root_storage_index_string()
|
return self.monitor.get_status().get_root_storage_index_string()
|
||||||
|
|
||||||
|
def _get_monitor_counter(self, name):
|
||||||
|
return self.monitor.get_status().get_counters().get(name)
|
||||||
|
|
||||||
@renderer
|
@renderer
|
||||||
def objects_checked(self, req, tag):
|
def objects_checked(self, req, tag):
|
||||||
return str(self.monitor.get_status().get_counters()["count-objects-checked"])
|
return str(self._get_monitor_counter("count-objects-checked"))
|
||||||
|
|
||||||
@renderer
|
@renderer
|
||||||
def objects_healthy(self, req, tag):
|
def objects_healthy(self, req, tag):
|
||||||
return str(self.monitor.get_status().get_counters()["count-objects-healthy"])
|
return str(self._get_monitor_counter("count-objects-healthy"))
|
||||||
|
|
||||||
@renderer
|
@renderer
|
||||||
def objects_unhealthy(self, req, tag):
|
def objects_unhealthy(self, req, tag):
|
||||||
return str(self.monitor.get_status().get_counters()["count-objects-unhealthy"])
|
return str(self._get_monitor_counter("count-objects-unhealthy"))
|
||||||
|
|
||||||
@renderer
|
@renderer
|
||||||
def objects_unrecoverable(self, req, tag):
|
def objects_unrecoverable(self, req, tag):
|
||||||
return str(self.monitor.get_status().get_counters()["count-objects-unrecoverable"])
|
return str(self._get_monitor_counter("count-objects-unrecoverable"))
|
||||||
|
|
||||||
@renderer
|
@renderer
|
||||||
def count_corrupt_shares(self, req, tag):
|
def count_corrupt_shares(self, req, tag):
|
||||||
return str(self.monitor.get_status().get_counters()["count-corrupt-shares"])
|
return str(self._get_monitor_counter("count-corrupt-shares"))
|
||||||
|
|
||||||
@renderer
|
@renderer
|
||||||
def problems_p(self, req, tag):
|
def problems_p(self, req, tag):
|
||||||
@ -511,7 +512,7 @@ class DeepCheckResultsRendererElement(Element, ResultsBase, ReloadMixin):
|
|||||||
|
|
||||||
@renderer
|
@renderer
|
||||||
def servers_with_corrupt_shares_p(self, req, tag):
|
def servers_with_corrupt_shares_p(self, req, tag):
|
||||||
if self.monitor.get_status().get_counters()["count-corrupt-shares"]:
|
if self._get_monitor_counter("count-corrupt-shares"):
|
||||||
return tag
|
return tag
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
@ -535,7 +536,7 @@ class DeepCheckResultsRendererElement(Element, ResultsBase, ReloadMixin):
|
|||||||
|
|
||||||
@renderer
|
@renderer
|
||||||
def corrupt_shares_p(self, req, tag):
|
def corrupt_shares_p(self, req, tag):
|
||||||
if self.monitor.get_status().get_counters()["count-corrupt-shares"]:
|
if self._get_monitor_counter("count-corrupt-shares"):
|
||||||
return tag
|
return tag
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user