summary refs log tree commit diff
path: root/synapse/metrics/process_collector.py
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2016-10-28 11:12:31 +0100
committerMark Haines <mark.haines@matrix.org>2016-10-28 11:12:31 +0100
commit490b97d3e7c89981085fcc700c6e776a7d913ac7 (patch)
treeb4282c1b24da3a1c5ef416ff77f65c39798c73b2 /synapse/metrics/process_collector.py
parentBump changelog and version (diff)
parentMerge pull request #1184 from matrix-org/paul/metrics (diff)
downloadsynapse-490b97d3e7c89981085fcc700c6e776a7d913ac7.tar.xz
Merge branch 'develop' into release-v0.18.2
Diffstat (limited to 'synapse/metrics/process_collector.py')
-rw-r--r--synapse/metrics/process_collector.py10
1 files changed, 3 insertions, 7 deletions
diff --git a/synapse/metrics/process_collector.py b/synapse/metrics/process_collector.py
index 1c851d9234..0e95582368 100644
--- a/synapse/metrics/process_collector.py
+++ b/synapse/metrics/process_collector.py
@@ -20,8 +20,6 @@ import os
 import stat
 from resource import getrusage, RUSAGE_SELF
 
-from synapse.metrics import get_metrics_for
-
 
 TICKS_PER_SEC = 100
 BYTES_PER_PAGE = 4096
@@ -111,10 +109,10 @@ def _process_fds():
     return counts
 
 
-def register_process_collector():
+def register_process_collector(process_metrics):
     # Legacy synapse-invented metric names
 
-    resource_metrics = get_metrics_for("process.resource")
+    resource_metrics = process_metrics.make_subspace("resource")
 
     resource_metrics.register_collector(update_resource_metrics)
 
@@ -125,12 +123,10 @@ def register_process_collector():
     # kilobytes
     resource_metrics.register_callback("maxrss", lambda: rusage.ru_maxrss * 1024)
 
-    get_metrics_for("process").register_callback("fds", _process_fds, labels=["type"])
+    process_metrics.register_callback("fds", _process_fds, labels=["type"])
 
     # New prometheus-standard metric names
 
-    process_metrics = get_metrics_for("process")
-
     if HAVE_PROC_SELF_STAT:
         process_metrics.register_callback(
             "cpu_user_seconds_total",