summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
Diffstat (limited to 'synapse')
-rw-r--r--synapse/metrics/__init__.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/synapse/metrics/__init__.py b/synapse/metrics/__init__.py
index 434e7535cc..106458e104 100644
--- a/synapse/metrics/__init__.py
+++ b/synapse/metrics/__init__.py
@@ -113,6 +113,7 @@ def render_all():
 # process resource usage
 
 TICKS_PER_SEC = 100
+BYTES_PER_PAGE = 4096
 
 rusage = None
 stats = None
@@ -188,6 +189,13 @@ process_metrics.register_callback(
     "cpu_seconds_total", lambda: (float(stats[11]) + float(stats[12])) / TICKS_PER_SEC
 )
 
+process_metrics.register_callback(
+    "virtual_memory_bytes", lambda: int(stats[20])
+)
+process_metrics.register_callback(
+    "resident_memory_bytes", lambda: int(stats[21]) * BYTES_PER_PAGE
+)
+
 reactor_metrics = get_metrics_for("reactor")
 tick_time = reactor_metrics.register_distribution("tick_time")
 pending_calls_metric = reactor_metrics.register_distribution("pending_calls")