summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorPaul "LeoNerd" Evans <paul@matrix.org>2015-03-09 20:39:17 +0000
committerPaul "LeoNerd" Evans <paul@matrix.org>2015-03-12 16:24:51 +0000
commit642f725fd74df0a921912c5284a93a81dc0d448d (patch)
treee85e5964496116df129af2c862f1ba5c417a8ff5 /synapse/storage
parentExport CacheMetric as hits+total, rather than hits+misses, as it's easier to ... (diff)
downloadsynapse-642f725fd74df0a921912c5284a93a81dc0d448d.tar.xz
Pretend the 'getEvent' cache is just another cache in the set of all the others for metric
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/_base.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/synapse/storage/_base.py b/synapse/storage/_base.py
index 35d118c586..2708d3c5b6 100644
--- a/synapse/storage/_base.py
+++ b/synapse/storage/_base.py
@@ -202,10 +202,9 @@ 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_cache(
-            "getEventCache",
-            size_callback=lambda: len(self._get_event_cache),
-        )
+
+        # Pretend the getEventCache is just another named cache
+        caches_by_name["*getEvent*"] = self._get_event_cache
 
     def start_profiling(self):
         self._previous_loop_ts = self._clock.time_msec()
@@ -682,10 +681,10 @@ class SQLBaseStore(object):
             # Separate cache entries for each way to invoke _get_event_txn
             ret = cache[(check_redacted, get_prev_content, allow_rejected)]
 
-            self._get_event_cache_counter.inc_hits()
+            cache_counter.inc_hits("*getEvent*")
             return ret
         except KeyError:
-            self._get_event_cache_counter.inc_misses()
+            cache_counter.inc_misses("*getEvent*")
             pass
         finally:
             start_time = update_counter("event_cache", start_time)