summary refs log tree commit diff
path: root/synapse/storage/_base.py
diff options
context:
space:
mode:
authorPaul "LeoNerd" Evans <paul@matrix.org>2015-03-04 17:34:23 +0000
committerPaul "LeoNerd" Evans <paul@matrix.org>2015-03-12 16:24:50 +0000
commit8664599af77ba0ed6268b3112174dc8e0c91101b (patch)
tree204e482555e1dbb4a0cf3731442a65d9aad91ed2 /synapse/storage/_base.py
parentEnsure that exceptions while rendering individual metrics don't stop others f... (diff)
downloadsynapse-8664599af77ba0ed6268b3112174dc8e0c91101b.tar.xz
Rename CacheCounterMetric to just CacheMetric; add a CallbackMetric component to give the size of the cache
Diffstat (limited to 'synapse/storage/_base.py')
-rw-r--r--synapse/storage/_base.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/synapse/storage/_base.py b/synapse/storage/_base.py

index 804655e34d..d3c2bc7bfb 100644 --- a/synapse/storage/_base.py +++ b/synapse/storage/_base.py
@@ -59,7 +59,7 @@ def cached(max_entries=1000): def wrap(orig): cache = OrderedDict() - counter = metrics.register_cachecounter(orig.__name__) + counter = metrics.register_cache(orig.__name__, lambda: len(cache)) def prefill(key, value): while len(cache) > max_entries: @@ -183,8 +183,8 @@ class SQLBaseStore(object): self._get_event_counters = PerformanceCounters() self._get_event_cache = LruCache(hs.config.event_cache_size) - self._get_event_cache_counter = metrics.register_cachecounter( - "get_event" + self._get_event_cache_counter = metrics.register_cache("get_event", + size_callback=lambda: len(self._get_event_cache), ) def start_profiling(self):