summary refs log tree commit diff
path: root/synapse/util/caches/descriptors.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-08-12 10:13:35 +0100
committerErik Johnston <erik@matrix.org>2015-08-12 10:13:35 +0100
commit4807616e1615bdaaee56f800ba682d0d019de610 (patch)
tree568f2ada12f2cb6c2f23672ee74818ff14e92433 /synapse/util/caches/descriptors.py
parentMove all the caches into their own package, synapse.util.caches (diff)
downloadsynapse-4807616e1615bdaaee56f800ba682d0d019de610.tar.xz
Wire up the dictionarycache to the metrics
Diffstat (limited to 'synapse/util/caches/descriptors.py')
-rw-r--r--synapse/util/caches/descriptors.py17
1 files changed, 3 insertions, 14 deletions
diff --git a/synapse/util/caches/descriptors.py b/synapse/util/caches/descriptors.py
index 82dd09cf5e..c99fda849e 100644
--- a/synapse/util/caches/descriptors.py
+++ b/synapse/util/caches/descriptors.py
@@ -1,5 +1,5 @@
 # -*- coding: utf-8 -*-
-# Copyright 2014, 2015 OpenMarket Ltd
+# Copyright 2015 OpenMarket Ltd
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -17,7 +17,8 @@ import logging
 from synapse.util.async import ObservableDeferred
 from synapse.util import unwrapFirstError
 from synapse.util.caches.lrucache import LruCache
-import synapse.metrics
+
+from . import caches_by_name, DEBUG_CACHES, cache_counter
 
 from twisted.internet import defer
 
@@ -30,18 +31,6 @@ import threading
 logger = logging.getLogger(__name__)
 
 
-DEBUG_CACHES = False
-
-metrics = synapse.metrics.get_metrics_for("synapse.util.caches")
-
-caches_by_name = {}
-cache_counter = metrics.register_cache(
-    "cache",
-    lambda: {(name,): len(caches_by_name[name]) for name in caches_by_name.keys()},
-    labels=["name"],
-)
-
-
 _CacheSentinel = object()