From 59a0682f3e9fe64c7ab35c011b0af7b87ee54f71 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Fri, 22 May 2015 13:13:07 +0100 Subject: Enable changing the interface the metrics listener binds to --- synapse/app/homeserver.py | 2 +- synapse/config/metrics.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/synapse/app/homeserver.py b/synapse/app/homeserver.py index fa43211415..70a7be60b8 100755 --- a/synapse/app/homeserver.py +++ b/synapse/app/homeserver.py @@ -277,7 +277,7 @@ class SynapseHomeServer(HomeServer): config, metrics_resource, ), - interface="127.0.0.1", + interface=config.metrics_interface, ) logger.info("Metrics now running on 127.0.0.1 port %d", config.metrics_port) diff --git a/synapse/config/metrics.py b/synapse/config/metrics.py index 71a1b1d189..c843c079cf 100644 --- a/synapse/config/metrics.py +++ b/synapse/config/metrics.py @@ -20,6 +20,7 @@ class MetricsConfig(Config): def read_config(self, config): self.enable_metrics = config["enable_metrics"] self.metrics_port = config.get("metrics_port") + self.metrics_interface = config.get("metrics_interface", "127.0.0.1") def default_config(self, config_dir_path, server_name): return """\ @@ -28,6 +29,9 @@ class MetricsConfig(Config): # Enable collection and rendering of performance metrics enable_metrics: False - # Separate port to accept metrics requests on (on localhost) + # Separate port to accept metrics requests on # metrics_port: 8081 + + # Which interface to bind the metric listener to + # metrics_interface: 127.0.0.1 """ -- cgit 1.4.1 From 8bb85c8c5a24f5a937fbd66eace23bd680ca728f Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Fri, 22 May 2015 14:48:06 +0100 Subject: Update log line --- synapse/app/homeserver.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/synapse/app/homeserver.py b/synapse/app/homeserver.py index 70a7be60b8..b887562f93 100755 --- a/synapse/app/homeserver.py +++ b/synapse/app/homeserver.py @@ -279,7 +279,10 @@ class SynapseHomeServer(HomeServer): ), interface=config.metrics_interface, ) - logger.info("Metrics now running on 127.0.0.1 port %d", config.metrics_port) + logger.info( + "Metrics now running on %s port %d", + config.metrics_interface, config.metrics_port, + ) def run_startup_checks(self, db_conn, database_engine): all_users_native = are_all_users_on_domain( -- cgit 1.4.1 From 1ce1509989ae5eba67acbe0824d82177ab10917f Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Fri, 22 May 2015 14:51:22 +0100 Subject: s/metric_interface/metric_bind_host/ --- synapse/app/homeserver.py | 4 ++-- synapse/config/metrics.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/synapse/app/homeserver.py b/synapse/app/homeserver.py index b887562f93..f3513abb55 100755 --- a/synapse/app/homeserver.py +++ b/synapse/app/homeserver.py @@ -277,11 +277,11 @@ class SynapseHomeServer(HomeServer): config, metrics_resource, ), - interface=config.metrics_interface, + interface=config.metrics_bind_host, ) logger.info( "Metrics now running on %s port %d", - config.metrics_interface, config.metrics_port, + config.metrics_bind_host, config.metrics_port, ) def run_startup_checks(self, db_conn, database_engine): diff --git a/synapse/config/metrics.py b/synapse/config/metrics.py index c843c079cf..0cfb30ce7f 100644 --- a/synapse/config/metrics.py +++ b/synapse/config/metrics.py @@ -20,7 +20,7 @@ class MetricsConfig(Config): def read_config(self, config): self.enable_metrics = config["enable_metrics"] self.metrics_port = config.get("metrics_port") - self.metrics_interface = config.get("metrics_interface", "127.0.0.1") + self.metrics_bind_host = config.get("metrics_bind_host", "127.0.0.1") def default_config(self, config_dir_path, server_name): return """\ @@ -32,6 +32,6 @@ class MetricsConfig(Config): # Separate port to accept metrics requests on # metrics_port: 8081 - # Which interface to bind the metric listener to - # metrics_interface: 127.0.0.1 + # Which host to bind the metric listener to + # metrics_bind_host: 127.0.0.1 """ -- cgit 1.4.1