diff options
author | Richard van der Hoff <richard@matrix.org> | 2018-10-19 21:49:26 +0100 |
---|---|---|
committer | Richard van der Hoff <richard@matrix.org> | 2018-10-19 21:51:15 +0100 |
commit | e5b52d0f945962a5f4bef5e7a2fb6445dfc0d8f8 (patch) | |
tree | 8a684a1da975835ca013874dbc28ec80d7da3762 /synapse/app | |
parent | Merge branch 'rav/fix_email_templates_4065' into develop (diff) | |
download | synapse-e5b52d0f945962a5f4bef5e7a2fb6445dfc0d8f8.tar.xz |
Make psutil an explicit dependency
As of #4027, we require psutil to be installed, so it should be in our dependency list. We can also remove some of the conditional import code introduced by #992. Fixes #4062.
Diffstat (limited to 'synapse/app')
-rwxr-xr-x | synapse/app/homeserver.py | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/synapse/app/homeserver.py b/synapse/app/homeserver.py index e3f0d99a3f..a0c0fc78ec 100755 --- a/synapse/app/homeserver.py +++ b/synapse/app/homeserver.py @@ -20,6 +20,7 @@ import sys from six import iteritems +import psutil from prometheus_client import Gauge from twisted.application import service @@ -502,7 +503,6 @@ def run(hs): def performance_stats_init(): try: - import psutil process = psutil.Process() # Ensure we can fetch both, and make the initial request for cpu_percent # so the next request will use this as the initial point. @@ -510,12 +510,9 @@ def run(hs): process.cpu_percent(interval=None) logger.info("report_stats can use psutil") stats_process.append(process) - except (ImportError, AttributeError): - logger.warn( - "report_stats enabled but psutil is not installed or incorrect version." - " Disabling reporting of memory/cpu stats." - " Ensuring psutil is available will help matrix.org track performance" - " changes across releases." + except (AttributeError): + logger.warning( + "Unable to read memory/cpu stats. Disabling reporting." ) def generate_user_daily_visit_stats(): |