mirror of
https://github.com/element-hq/synapse
synced 2024-09-12 07:05:12 +00:00
Fix metrics
This commit is contained in:
parent
6b64fde674
commit
d92c6fcfd9
1 changed files with 8 additions and 4 deletions
|
@ -54,8 +54,10 @@ if TYPE_CHECKING:
|
|||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
doorkeeper_counter = Counter("synapse_lru_cache_doorkeeper_total", "")
|
||||
doorkeeper_hit_counter = Counter("synapse_lru_cache_doorkeeper_hits", "")
|
||||
doorkeeper_counter = Counter("synapse_lru_cache_doorkeeper_total", "", ("cache_name",))
|
||||
doorkeeper_hit_counter = Counter(
|
||||
"synapse_lru_cache_doorkeeper_hits", "", ("cache_name",)
|
||||
)
|
||||
|
||||
try:
|
||||
from pympler.asizeof import Asizer
|
||||
|
@ -513,7 +515,8 @@ 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()
|
||||
if cache_name:
|
||||
doorkeeper_counter.labels(cache_name).inc()
|
||||
found = self._doorkeeper.contains(hash_key) | self._doorkeeper_2.contains(
|
||||
hash_key
|
||||
)
|
||||
|
@ -521,7 +524,8 @@ class LruCache(Generic[KT, VT]):
|
|||
self._doorkeeper.insert(hash_key)
|
||||
return
|
||||
|
||||
doorkeeper_hit_counter.inc()
|
||||
if cache_name:
|
||||
doorkeeper_hit_counter.labels(cache_name).inc()
|
||||
|
||||
node: _Node[KT, VT] = _Node(
|
||||
list_root,
|
||||
|
|
Loading…
Reference in a new issue