mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-14 19:33:52 +01:00
better exception logging in callbackmetrics
when we fail to render a metric, give a clue as to which metric it was
This commit is contained in:
parent
a87006f9c7
commit
ce236f8ac8
1 changed files with 8 additions and 1 deletions
|
@ -15,6 +15,9 @@
|
||||||
|
|
||||||
|
|
||||||
from itertools import chain
|
from itertools import chain
|
||||||
|
import logging
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def flatten(items):
|
def flatten(items):
|
||||||
|
@ -153,7 +156,11 @@ class CallbackMetric(BaseMetric):
|
||||||
self.callback = callback
|
self.callback = callback
|
||||||
|
|
||||||
def render(self):
|
def render(self):
|
||||||
value = self.callback()
|
try:
|
||||||
|
value = self.callback()
|
||||||
|
except Exception:
|
||||||
|
logger.exception("Failed to render %s", self.name)
|
||||||
|
return ["# FAILED to render " + self.name]
|
||||||
|
|
||||||
if self.is_scalar():
|
if self.is_scalar():
|
||||||
return list(self._render_for_labels([], value))
|
return list(self._render_for_labels([], value))
|
||||||
|
|
Loading…
Reference in a new issue