A trivial 'hello world'-style resource on /_synapse/metrics, with optional commandline flag

This commit is contained in:
Paul "LeoNerd" Evans 2015-02-24 15:49:14 +00:00
parent 5b6e11d560
commit e07fc62833
2 changed files with 44 additions and 0 deletions

View file

@ -147,6 +147,13 @@ class SynapseHomeServer(HomeServer):
else:
self.root_resource = Resource()
if self.get_config().enable_metrics:
from synapse.metrics.resource import (
MetricsResource, METRICS_PREFIX
)
desired_tree.append((METRICS_PREFIX, MetricsResource(self)))
# ideally we'd just use getChild and putChild but getChild doesn't work
# unless you give it a Request object IN ADDITION to the name :/ So
# instead, we'll store a copy of this mapping so we can actually add