diff options
author | Amber Brown <hawkowl@atleastfornow.net> | 2018-05-31 19:04:50 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-31 19:04:50 +1000 |
commit | febe0ec8fd78028fe7c7b3a26a8dd85c32ee1550 (patch) | |
tree | 2113033f9f601fc723a47b45ef8f2652ef68cc6d /synapse/app/_base.py | |
parent | Consistently use six's iteritems and wrap lazy keys/values in list() if they'... (diff) | |
download | synapse-febe0ec8fd78028fe7c7b3a26a8dd85c32ee1550.tar.xz |
Run Prometheus on a different port, optionally. (#3274)
Diffstat (limited to 'synapse/app/_base.py')
-rw-r--r-- | synapse/app/_base.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/synapse/app/_base.py b/synapse/app/_base.py index e4318cdfc3..a6925ab139 100644 --- a/synapse/app/_base.py +++ b/synapse/app/_base.py @@ -124,6 +124,19 @@ def quit_with_error(error_string): sys.exit(1) +def listen_metrics(bind_addresses, port): + """ + Start Prometheus metrics server. + """ + from synapse.metrics import RegistryProxy + from prometheus_client import start_http_server + + for host in bind_addresses: + reactor.callInThread(start_http_server, int(port), + addr=host, registry=RegistryProxy) + logger.info("Metrics now reporting on %s:%d", host, port) + + def listen_tcp(bind_addresses, port, factory, backlog=50): """ Create a TCP socket for a port and several addresses |