Skip to content

Commit c964dbc

Browse files
committed
metrics: add option metrics.addr for ipv6 support
`prometheus_client` supports IPv6 addresses for a while now[1]. This isn't used here however because the default 0.0.0.0 is used. Added an option `metrics.addr` that makes this configurable. [1] prometheus/client_python@39d2360
1 parent 3e22e61 commit c964dbc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

mautrix/util/program.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ def start_prometheus(self) -> None:
188188
try:
189189
enabled = self.config["metrics.enabled"]
190190
listen_port = self.config["metrics.listen_port"]
191+
addr = self.config.get("metrics.addr", '0.0.0.0')
191192
except KeyError:
192193
return
193194
if not enabled:
@@ -197,7 +198,7 @@ def start_prometheus(self) -> None:
197198
"Metrics are enabled in config, but prometheus_client is not installed"
198199
)
199200
return
200-
prometheus.start_http_server(listen_port)
201+
prometheus.start_http_server(listen_port, addr=addr)
201202

202203
def _run(self) -> None:
203204
signal.signal(signal.SIGINT, signal.default_int_handler)

0 commit comments

Comments
 (0)