add report_stats_endpoint config option (#6012)

This PR adds the optional `report_stats_endpoint` to configure where stats are reported to, if enabled.
This commit is contained in:
Sorunome 2019-09-12 12:24:57 +02:00 committed by Richard van der Hoff
parent a8251da10f
commit dd2e5b0038
4 changed files with 19 additions and 2 deletions

View file

@ -561,10 +561,12 @@ def run(hs):
stats["database_engine"] = hs.get_datastore().database_engine_name
stats["database_server_version"] = hs.get_datastore().get_server_version()
logger.info("Reporting stats to matrix.org: %s" % (stats,))
logger.info(
"Reporting stats to %s: %s" % (hs.config.report_stats_endpoint, stats)
)
try:
yield hs.get_simple_http_client().put_json(
"https://matrix.org/report-usage-stats/push", stats
hs.config.report_stats_endpoint, stats
)
except Exception as e:
logger.warn("Error reporting stats: %s", e)