summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthew Hodgson <matthew@matrix.org>2018-05-29 02:22:27 +0100
committerMatthew Hodgson <matthew@matrix.org>2018-05-29 02:22:27 +0100
commitb69ff33d9e26e9efe89c745e0fda4801db8bede0 (patch)
tree1b6d9e608ce42cbf34cccc713731db7170204b6e
parentfix dumb typo (diff)
downloadsynapse-b69ff33d9e26e9efe89c745e0fda4801db8bede0.tar.xz
disable CPUMetrics if no /proc/self/stat
fixes build on macOS again
-rw-r--r--synapse/metrics/__init__.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/synapse/metrics/__init__.py b/synapse/metrics/__init__.py

index 371c300cac..6b5b0c9471 100644 --- a/synapse/metrics/__init__.py +++ b/synapse/metrics/__init__.py
@@ -34,6 +34,7 @@ all_metrics = [] all_collectors = [] all_gauges = {} +HAVE_PROC_SELF_STAT = os.path.exists("/proc/self/stat") class RegistryProxy(object): @@ -99,6 +100,8 @@ class CPUMetrics(object): self.ticks_per_sec = ticks_per_sec def collect(self): + if not HAVE_PROC_SELF_STAT: + return with open("/proc/self/stat") as s: line = s.read()