summary refs log tree commit diff
path: root/synapse
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:23:30 +0100
commit0a240ad36eec189b5a85cc3f2c215e3e5898d5b7 (patch)
treecab85c93d2c531bb0dfc8ba0019b101745c18aca /synapse
parentfix dumb typo (diff)
downloadsynapse-0a240ad36eec189b5a85cc3f2c215e3e5898d5b7.tar.xz
disable CPUMetrics if no /proc/self/stat
fixes build on macOS again
Diffstat (limited to 'synapse')
-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()