mirror of
https://mau.dev/maunium/synapse.git
synced 2025-01-06 02:03:59 +01:00
Pretend the 'getEvent' cache is just another cache in the set of all the others for metric
This commit is contained in:
parent
cbc0406be8
commit
642f725fd7
1 changed files with 5 additions and 6 deletions
|
@ -202,10 +202,9 @@ class SQLBaseStore(object):
|
||||||
self._get_event_counters = PerformanceCounters()
|
self._get_event_counters = PerformanceCounters()
|
||||||
|
|
||||||
self._get_event_cache = LruCache(hs.config.event_cache_size)
|
self._get_event_cache = LruCache(hs.config.event_cache_size)
|
||||||
self._get_event_cache_counter = metrics.register_cache(
|
|
||||||
"getEventCache",
|
# Pretend the getEventCache is just another named cache
|
||||||
size_callback=lambda: len(self._get_event_cache),
|
caches_by_name["*getEvent*"] = self._get_event_cache
|
||||||
)
|
|
||||||
|
|
||||||
def start_profiling(self):
|
def start_profiling(self):
|
||||||
self._previous_loop_ts = self._clock.time_msec()
|
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
|
# Separate cache entries for each way to invoke _get_event_txn
|
||||||
ret = cache[(check_redacted, get_prev_content, allow_rejected)]
|
ret = cache[(check_redacted, get_prev_content, allow_rejected)]
|
||||||
|
|
||||||
self._get_event_cache_counter.inc_hits()
|
cache_counter.inc_hits("*getEvent*")
|
||||||
return ret
|
return ret
|
||||||
except KeyError:
|
except KeyError:
|
||||||
self._get_event_cache_counter.inc_misses()
|
cache_counter.inc_misses("*getEvent*")
|
||||||
pass
|
pass
|
||||||
finally:
|
finally:
|
||||||
start_time = update_counter("event_cache", start_time)
|
start_time = update_counter("event_cache", start_time)
|
||||||
|
|
Loading…
Reference in a new issue