Handle review comments
This commit is contained in:
parent
4ceaa7433a
commit
33f6195d9a
|
@ -401,6 +401,9 @@ def run(hs):
|
||||||
start_time = clock.time()
|
start_time = clock.time()
|
||||||
|
|
||||||
stats = {}
|
stats = {}
|
||||||
|
|
||||||
|
# Contains the list of processes we will be monitoring
|
||||||
|
# currently either 0 or 1
|
||||||
stats_process = []
|
stats_process = []
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
|
@ -428,11 +431,11 @@ def run(hs):
|
||||||
|
|
||||||
daily_sent_messages = yield hs.get_datastore().count_daily_sent_messages()
|
daily_sent_messages = yield hs.get_datastore().count_daily_sent_messages()
|
||||||
stats["daily_sent_messages"] = daily_sent_messages
|
stats["daily_sent_messages"] = daily_sent_messages
|
||||||
|
|
||||||
if len(stats_process) > 0:
|
if len(stats_process) > 0:
|
||||||
stats["memory_rss"] = 0
|
stats["memory_rss"] = 0
|
||||||
stats["cpu_average"] = 0
|
stats["cpu_average"] = 0
|
||||||
for process in stats_process:
|
for process in stats_process:
|
||||||
with process.oneshot():
|
|
||||||
stats["memory_rss"] += process.memory_info().rss
|
stats["memory_rss"] += process.memory_info().rss
|
||||||
stats["cpu_average"] += int(process.cpu_percent(interval=None))
|
stats["cpu_average"] += int(process.cpu_percent(interval=None))
|
||||||
|
|
||||||
|
@ -459,8 +462,8 @@ def run(hs):
|
||||||
logger.warn(
|
logger.warn(
|
||||||
"report_stats enabled but psutil is not installed or incorrect version."
|
"report_stats enabled but psutil is not installed or incorrect version."
|
||||||
" Disabling reporting of memory/cpu stats."
|
" Disabling reporting of memory/cpu stats."
|
||||||
" Ensuring psutil is available will help matrix track performance changes"
|
" Ensuring psutil is available will help matrix.org track performance"
|
||||||
" across releases."
|
" changes across releases."
|
||||||
)
|
)
|
||||||
|
|
||||||
if hs.config.report_stats:
|
if hs.config.report_stats:
|
||||||
|
@ -469,7 +472,7 @@ def run(hs):
|
||||||
|
|
||||||
# We need to defer this init for the cases that we daemonize
|
# We need to defer this init for the cases that we daemonize
|
||||||
# otherwise the process ID we get is that of the non-daemon process
|
# otherwise the process ID we get is that of the non-daemon process
|
||||||
clock.call_later(15, performance_stats_init)
|
clock.call_later(0, performance_stats_init)
|
||||||
|
|
||||||
# We wait 5 minutes to send the first set of stats as the server can
|
# We wait 5 minutes to send the first set of stats as the server can
|
||||||
# be quite busy the first few minutes
|
# be quite busy the first few minutes
|
||||||
|
|
Loading…
Reference in New Issue