summary refs log tree commit diff
path: root/synapse/app/media_repository.py
diff options
context:
space:
mode:
authorAmber Brown <hawkowl@atleastfornow.net>2018-05-31 19:04:50 +1000
committerGitHub <noreply@github.com>2018-05-31 19:04:50 +1000
commitfebe0ec8fd78028fe7c7b3a26a8dd85c32ee1550 (patch)
tree2113033f9f601fc723a47b45ef8f2652ef68cc6d /synapse/app/media_repository.py
parentConsistently use six's iteritems and wrap lazy keys/values in list() if they'... (diff)
downloadsynapse-febe0ec8fd78028fe7c7b3a26a8dd85c32ee1550.tar.xz
Run Prometheus on a different port, optionally. (#3274)
Diffstat (limited to 'synapse/app/media_repository.py')
-rw-r--r--synapse/app/media_repository.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/synapse/app/media_repository.py b/synapse/app/media_repository.py
index 9c93195f0a..006bba80a8 100644
--- a/synapse/app/media_repository.py
+++ b/synapse/app/media_repository.py
@@ -27,6 +27,7 @@ from synapse.config.homeserver import HomeServerConfig
 from synapse.config.logger import setup_logging
 from synapse.crypto import context_factory
 from synapse.http.site import SynapseSite
+from synapse.metrics import RegistryProxy
 from synapse.metrics.resource import METRICS_PREFIX, MetricsResource
 from synapse.replication.slave.storage._base import BaseSlavedStore
 from synapse.replication.slave.storage.appservice import SlavedApplicationServiceStore
@@ -73,7 +74,7 @@ class MediaRepositoryServer(HomeServer):
         for res in listener_config["resources"]:
             for name in res["names"]:
                 if name == "metrics":
-                    resources[METRICS_PREFIX] = MetricsResource(self)
+                    resources[METRICS_PREFIX] = MetricsResource(RegistryProxy)
                 elif name == "media":
                     media_repo = self.get_media_repository_resource()
                     resources.update({
@@ -114,6 +115,13 @@ class MediaRepositoryServer(HomeServer):
                         globals={"hs": self},
                     )
                 )
+            elif listener["type"] == "metrics":
+                if not self.get_config().enable_metrics:
+                    logger.warn(("Metrics listener configured, but "
+                                 "collect_metrics is not enabled!"))
+                else:
+                    _base.listen_metrics(listener["bind_addresses"],
+                                         listener["port"])
             else:
                 logger.warn("Unrecognized listener type: %s", listener["type"])