0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-12-17 18:33:55 +01:00

disable CPUMetrics if no /proc/self/stat

fixes build on macOS again
This commit is contained in:
Matthew Hodgson 2018-05-29 02:22:27 +01:00
parent 5e6b31f0da
commit b69ff33d9e

View file

@ -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()