diff options
author | Matthew Hodgson <matthew@matrix.org> | 2018-05-29 02:22:27 +0100 |
---|---|---|
committer | Matthew Hodgson <matthew@matrix.org> | 2018-05-29 02:22:27 +0100 |
commit | b69ff33d9e26e9efe89c745e0fda4801db8bede0 (patch) | |
tree | 1b6d9e608ce42cbf34cccc713731db7170204b6e | |
parent | fix dumb typo (diff) | |
download | synapse-b69ff33d9e26e9efe89c745e0fda4801db8bede0.tar.xz |
disable CPUMetrics if no /proc/self/stat
fixes build on macOS again
-rw-r--r-- | synapse/metrics/__init__.py | 3 |
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() |