forked from MirrorHub/synapse
Merge pull request #4073 from matrix-org/rav/require_psutil
Make psutil an explicit dependency
This commit is contained in:
commit
911db96658
3 changed files with 6 additions and 10 deletions
1
changelog.d/4073.misc
Normal file
1
changelog.d/4073.misc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Add psutil as an explicit dependency
|
|
@ -20,6 +20,7 @@ import sys
|
||||||
|
|
||||||
from six import iteritems
|
from six import iteritems
|
||||||
|
|
||||||
|
import psutil
|
||||||
from prometheus_client import Gauge
|
from prometheus_client import Gauge
|
||||||
|
|
||||||
from twisted.application import service
|
from twisted.application import service
|
||||||
|
@ -502,7 +503,6 @@ def run(hs):
|
||||||
|
|
||||||
def performance_stats_init():
|
def performance_stats_init():
|
||||||
try:
|
try:
|
||||||
import psutil
|
|
||||||
process = psutil.Process()
|
process = psutil.Process()
|
||||||
# Ensure we can fetch both, and make the initial request for cpu_percent
|
# Ensure we can fetch both, and make the initial request for cpu_percent
|
||||||
# so the next request will use this as the initial point.
|
# so the next request will use this as the initial point.
|
||||||
|
@ -510,12 +510,9 @@ def run(hs):
|
||||||
process.cpu_percent(interval=None)
|
process.cpu_percent(interval=None)
|
||||||
logger.info("report_stats can use psutil")
|
logger.info("report_stats can use psutil")
|
||||||
stats_process.append(process)
|
stats_process.append(process)
|
||||||
except (ImportError, AttributeError):
|
except (AttributeError):
|
||||||
logger.warn(
|
logger.warning(
|
||||||
"report_stats enabled but psutil is not installed or incorrect version."
|
"Unable to read memory/cpu stats. Disabling reporting."
|
||||||
" Disabling reporting of memory/cpu stats."
|
|
||||||
" Ensuring psutil is available will help matrix.org track performance"
|
|
||||||
" changes across releases."
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def generate_user_daily_visit_stats():
|
def generate_user_daily_visit_stats():
|
||||||
|
|
|
@ -53,6 +53,7 @@ REQUIREMENTS = {
|
||||||
"pillow>=3.1.2": ["PIL"],
|
"pillow>=3.1.2": ["PIL"],
|
||||||
"pydenticon>=0.2": ["pydenticon"],
|
"pydenticon>=0.2": ["pydenticon"],
|
||||||
"sortedcontainers>=1.4.4": ["sortedcontainers"],
|
"sortedcontainers>=1.4.4": ["sortedcontainers"],
|
||||||
|
"psutil>=2.0.0": ["psutil>=2.0.0"],
|
||||||
"pysaml2>=3.0.0": ["saml2"],
|
"pysaml2>=3.0.0": ["saml2"],
|
||||||
"pymacaroons-pynacl>=0.9.3": ["pymacaroons"],
|
"pymacaroons-pynacl>=0.9.3": ["pymacaroons"],
|
||||||
"msgpack-python>=0.4.2": ["msgpack"],
|
"msgpack-python>=0.4.2": ["msgpack"],
|
||||||
|
@ -79,9 +80,6 @@ CONDITIONAL_REQUIREMENTS = {
|
||||||
"matrix-synapse-ldap3": {
|
"matrix-synapse-ldap3": {
|
||||||
"matrix-synapse-ldap3>=0.1": ["ldap_auth_provider"],
|
"matrix-synapse-ldap3>=0.1": ["ldap_auth_provider"],
|
||||||
},
|
},
|
||||||
"psutil": {
|
|
||||||
"psutil>=2.0.0": ["psutil>=2.0.0"],
|
|
||||||
},
|
|
||||||
"postgres": {
|
"postgres": {
|
||||||
"psycopg2>=2.6": ["psycopg2"]
|
"psycopg2>=2.6": ["psycopg2"]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue