diff options
author | Erik Johnston <erik@matrix.org> | 2022-07-17 16:29:26 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2022-07-17 16:29:26 +0100 |
commit | 6b64fde67449843b6b0fdb8a608c884eacaf429f (patch) | |
tree | 5544466f63a2d181830a62caaa5e6b63301c9d49 /synapse | |
parent | Add doorkeeper (diff) | |
download | synapse-6b64fde67449843b6b0fdb8a608c884eacaf429f.tar.xz |
Doorkeeper metrics
Diffstat (limited to 'synapse')
-rw-r--r-- | synapse/util/caches/lrucache.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/synapse/util/caches/lrucache.py b/synapse/util/caches/lrucache.py index c640c238d5..af38b1c1f5 100644 --- a/synapse/util/caches/lrucache.py +++ b/synapse/util/caches/lrucache.py @@ -35,6 +35,7 @@ from typing import ( ) from cuckoo.filter import ScalableCuckooFilter +from prometheus_client import Counter from typing_extensions import Literal from twisted.internet import reactor @@ -53,6 +54,9 @@ if TYPE_CHECKING: logger = logging.getLogger(__name__) +doorkeeper_counter = Counter("synapse_lru_cache_doorkeeper_total", "") +doorkeeper_hit_counter = Counter("synapse_lru_cache_doorkeeper_hits", "") + try: from pympler.asizeof import Asizer @@ -509,6 +513,7 @@ class LruCache(Generic[KT, VT]): key: KT, value: VT, callbacks: Collection[Callable[[], None]] = () ) -> None: hash_key = hash(()).to_bytes(8, byteorder="big") + doorkeeper_counter.inc() found = self._doorkeeper.contains(hash_key) | self._doorkeeper_2.contains( hash_key ) @@ -516,6 +521,8 @@ class LruCache(Generic[KT, VT]): self._doorkeeper.insert(hash_key) return + doorkeeper_hit_counter.inc() + node: _Node[KT, VT] = _Node( list_root, key, |