diff options
author | Richard van der Hoff <github@rvanderhoff.org.uk> | 2018-01-18 11:46:37 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-18 11:46:37 +0000 |
commit | d6af5512bb73b19f4039c90fe53b4602dff32335 (patch) | |
tree | da20cbc3e348a95ce578fc2e47162b195289f3f0 /synapse | |
parent | Merge pull request #2805 from matrix-org/rav/log_state_res (diff) | |
parent | better exception logging in callbackmetrics (diff) | |
download | synapse-d6af5512bb73b19f4039c90fe53b4602dff32335.tar.xz |
Merge pull request #2809 from matrix-org/rav/metrics_errors
better exception logging in callbackmetrics
Diffstat (limited to 'synapse')
-rw-r--r-- | synapse/metrics/metric.py | 9 |
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)) |