mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-03 15:54:49 -04:00
Track why we're evicting from caches (#10829)
So we can see distinguish between "evicting because the cache is too big" and "evicting because the cache entries haven't been recently used".
This commit is contained in:
parent
51e2db3598
commit
a2d7195e01
4 changed files with 31 additions and 15 deletions
|
@ -40,7 +40,7 @@ from twisted.internet.interfaces import IReactorTime
|
|||
from synapse.config import cache as cache_config
|
||||
from synapse.metrics.background_process_metrics import wrap_as_background_process
|
||||
from synapse.util import Clock, caches
|
||||
from synapse.util.caches import CacheMetric, register_cache
|
||||
from synapse.util.caches import CacheMetric, EvictionReason, register_cache
|
||||
from synapse.util.caches.treecache import TreeCache, iterate_tree_cache_entry
|
||||
from synapse.util.linked_list import ListNode
|
||||
|
||||
|
@ -403,7 +403,7 @@ class LruCache(Generic[KT, VT]):
|
|||
evicted_len = delete_node(node)
|
||||
cache.pop(node.key, None)
|
||||
if metrics:
|
||||
metrics.inc_evictions(evicted_len)
|
||||
metrics.inc_evictions(EvictionReason.size, evicted_len)
|
||||
|
||||
def synchronized(f: FT) -> FT:
|
||||
@wraps(f)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue