summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorAmber Brown <hawkowl@atleastfornow.net>2018-05-29 11:45:45 +1000
committerGitHub <noreply@github.com>2018-05-29 11:45:45 +1000
commit235b53263a14174c366057e15a76cbcda6bb063f (patch)
tree7cc1c08d74616a4f0a16ae46d037d8b5b2c8e83b /synapse
parentfix another dumb typo (diff)
parentpep8 (diff)
downloadsynapse-235b53263a14174c366057e15a76cbcda6bb063f.tar.xz
Merge pull request #3299 from matrix-org/matthew/macos-fixes
disable CPUMetrics if no /proc/self/stat
Diffstat (limited to 'synapse')
-rw-r--r--synapse/metrics/__init__.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/synapse/metrics/__init__.py b/synapse/metrics/__init__.py
index 371c300cac..bfdbbc9a23 100644
--- a/synapse/metrics/__init__.py
+++ b/synapse/metrics/__init__.py
@@ -34,6 +34,8 @@ all_metrics = []
 all_collectors = []
 all_gauges = {}
 
+HAVE_PROC_SELF_STAT = os.path.exists("/proc/self/stat")
+
 
 class RegistryProxy(object):
 
@@ -99,6 +101,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()