0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-12-19 10:53:58 +01:00

Merge pull request #3299 from matrix-org/matthew/macos-fixes

disable CPUMetrics if no /proc/self/stat
This commit is contained in:
Amber Brown 2018-05-29 11:45:45 +10:00 committed by GitHub
commit 235b53263a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -34,6 +34,8 @@ all_metrics = []
all_collectors = [] all_collectors = []
all_gauges = {} all_gauges = {}
HAVE_PROC_SELF_STAT = os.path.exists("/proc/self/stat")
class RegistryProxy(object): class RegistryProxy(object):
@ -99,6 +101,8 @@ class CPUMetrics(object):
self.ticks_per_sec = ticks_per_sec self.ticks_per_sec = ticks_per_sec
def collect(self): def collect(self):
if not HAVE_PROC_SELF_STAT:
return
with open("/proc/self/stat") as s: with open("/proc/self/stat") as s:
line = s.read() line = s.read()