0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-12-14 18:03:53 +01:00

Merge pull request #2809 from matrix-org/rav/metrics_errors

better exception logging in callbackmetrics
This commit is contained in:
Richard van der Hoff 2018-01-18 11:46:37 +00:00 committed by GitHub
commit d6af5512bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -15,6 +15,9 @@
from itertools import chain
import logging
logger = logging.getLogger(__name__)
def flatten(items):
@ -153,7 +156,11 @@ class CallbackMetric(BaseMetric):
self.callback = callback
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():
return list(self._render_for_labels([], value))