diff options
author | Amber Brown <hawkowl@atleastfornow.net> | 2020-05-12 03:45:23 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-11 18:45:23 +0100 |
commit | 7cb8b4bc67042a39bd1b0e05df46089a2fce1955 (patch) | |
tree | 0dcb8d54969d325c55ea113e1b7a7bb18fd9aa65 /synapse/metrics | |
parent | Remove unused store method get_hosts_in_room (#7448) (diff) | |
download | synapse-7cb8b4bc67042a39bd1b0e05df46089a2fce1955.tar.xz |
Allow configuration of Synapse's cache without using synctl or environment variables (#6391)
Diffstat (limited to 'synapse/metrics')
-rw-r--r-- | synapse/metrics/_exposition.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/synapse/metrics/_exposition.py b/synapse/metrics/_exposition.py index a248103191..ab7f948ed4 100644 --- a/synapse/metrics/_exposition.py +++ b/synapse/metrics/_exposition.py @@ -33,6 +33,8 @@ from prometheus_client import REGISTRY from twisted.web.resource import Resource +from synapse.util import caches + try: from prometheus_client.samples import Sample except ImportError: @@ -103,13 +105,15 @@ def nameify_sample(sample): def generate_latest(registry, emit_help=False): - output = [] - for metric in registry.collect(): + # Trigger the cache metrics to be rescraped, which updates the common + # metrics but do not produce metrics themselves + for collector in caches.collectors_by_name.values(): + collector.collect() - if metric.name.startswith("__unused"): - continue + output = [] + for metric in registry.collect(): if not metric.samples: # No samples, don't bother. continue |