summary refs log tree commit diff
path: root/synapse/metrics/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'synapse/metrics/__init__.py')
-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()