summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-06-07 13:46:26 +0100
committerErik Johnston <erik@matrix.org>2016-06-07 13:46:26 +0100
commit188f8d63e221ff0104a7337e1e1f2d712425a317 (patch)
tree18eb8158929904faea01a7edb8385dd0a34a843b /synapse
parentMerge pull request #771 from matrix-org/erikj/gc_tick (diff)
parentAlso record number of unreachable objects (diff)
downloadsynapse-188f8d63e221ff0104a7337e1e1f2d712425a317.tar.xz
Merge pull request #847 from matrix-org/erikj/gc_tick
Change the way we do stats for GC
Diffstat (limited to 'synapse')
-rw-r--r--synapse/metrics/__init__.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/synapse/metrics/__init__.py b/synapse/metrics/__init__.py
index f317034b8f..b29cec3de1 100644
--- a/synapse/metrics/__init__.py
+++ b/synapse/metrics/__init__.py
@@ -153,11 +153,8 @@ reactor_metrics = get_metrics_for("reactor")
 tick_time = reactor_metrics.register_distribution("tick_time")
 pending_calls_metric = reactor_metrics.register_distribution("pending_calls")
 
-gc_time = (
-    reactor_metrics.register_distribution("gc_time_gen0"),
-    reactor_metrics.register_distribution("gc_time_gen2"),
-    reactor_metrics.register_distribution("gc_time_gen2"),
-)
+gc_time = reactor_metrics.register_distribution("gc_time", labels=["gen"])
+gc_unreachable = reactor_metrics.register_counter("gc_unreachable", labels=["gen"])
 
 
 def runUntilCurrentTimer(func):
@@ -190,15 +187,16 @@ def runUntilCurrentTimer(func):
         # one if necessary.
         threshold = gc.get_threshold()
         counts = gc.get_count()
-        for i in [2, 1, 0]:
+        for i in (2, 1, 0):
             if threshold[i] < counts[i]:
                 logger.info("Collecting gc %d", i)
 
                 start = time.time() * 1000
-                gc.collect(i)
+                unreachable = gc.collect(i)
                 end = time.time() * 1000
 
-                gc_time[i].inc_by(end - start)
+                gc_time.inc_by(end - start, i)
+                gc_unreachable.inc_by(unreachable, i)
 
         return ret