@@ -129,7 +129,8 @@ def create_resource_tree(self, redirect_root_to_web_client):
129
129
location of the web client. This does nothing if web_client is not
130
130
True.
131
131
"""
132
- web_client = self .get_config ().webclient
132
+ config = self .get_config ()
133
+ web_client = config .webclient
133
134
134
135
# list containing (path_str, Resource) e.g:
135
136
# [ ("/aaa/bbb/cc", Resource1), ("/aaa/dummy", Resource2) ]
@@ -155,7 +156,7 @@ def create_resource_tree(self, redirect_root_to_web_client):
155
156
self .root_resource = Resource ()
156
157
157
158
metrics_resource = self .get_resource_for_metrics ()
158
- if metrics_resource is not None :
159
+ if config . metrics_port is None and metrics_resource is not None :
159
160
desired_tree .append ((METRICS_PREFIX , metrics_resource ))
160
161
161
162
# ideally we'd just use getChild and putChild but getChild doesn't work
@@ -234,6 +235,13 @@ def start_listening(self):
234
235
)
235
236
logger .info ("Synapse now listening on port %d" , config .unsecure_port )
236
237
238
+ metrics_resource = self .get_resource_for_metrics ()
239
+ if metrics_resource and config .metrics_port is not None :
240
+ reactor .listenTCP (
241
+ config .metrics_port , Site (metrics_resource ), interface = "127.0.0.1" ,
242
+ )
243
+ logger .info ("Metrics now running on 127.0.0.1 port %d" , config .metrics_port )
244
+
237
245
238
246
def get_version_string ():
239
247
try :
0 commit comments