summary refs log tree commit diff
path: root/synapse/util/caches/__init__.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/__init__.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/__init__.py')
-rw-r--r--synapse/util/caches/__init__.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/synapse/util/caches/__init__.py b/synapse/util/caches/__init__.py
index 1a84d94cd9..da0e06a468 100644
--- a/synapse/util/caches/__init__.py
+++ b/synapse/util/caches/__init__.py
@@ -12,3 +12,16 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
+
+import synapse.metrics
+
+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"],
+)