mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 10:46:06 -04:00
Allow configuration of Synapse's cache without using synctl or environment variables (#6391)
This commit is contained in:
parent
a8580c5f19
commit
7cb8b4bc67
32 changed files with 620 additions and 146 deletions
|
@ -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):
|
||||
|
||||
# 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()
|
||||
|
||||
output = []
|
||||
|
||||
for metric in registry.collect():
|
||||
|
||||
if metric.name.startswith("__unused"):
|
||||
continue
|
||||
|
||||
if not metric.samples:
|
||||
# No samples, don't bother.
|
||||
continue
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue