summary refs log tree commit diff
path: root/synapse/metrics
diff options
context:
space:
mode:
authorRichard van der Hoff <github@rvanderhoff.org.uk>2018-01-18 11:46:37 +0000
committerGitHub <noreply@github.com>2018-01-18 11:46:37 +0000
commitd6af5512bb73b19f4039c90fe53b4602dff32335 (patch)
treeda20cbc3e348a95ce578fc2e47162b195289f3f0 /synapse/metrics
parentMerge pull request #2805 from matrix-org/rav/log_state_res (diff)
parentbetter exception logging in callbackmetrics (diff)
downloadsynapse-d6af5512bb73b19f4039c90fe53b4602dff32335.tar.xz
Merge pull request #2809 from matrix-org/rav/metrics_errors
better exception logging in callbackmetrics
Diffstat (limited to 'synapse/metrics')
-rw-r--r--synapse/metrics/metric.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/synapse/metrics/metric.py b/synapse/metrics/metric.py
index f480aae614..1e783e5ff4 100644
--- a/synapse/metrics/metric.py
+++ b/synapse/metrics/metric.py
@@ -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))