summary refs log tree commit diff
path: root/synapse/metrics
diff options
context:
space:
mode:
Diffstat (limited to 'synapse/metrics')
-rw-r--r--synapse/metrics/__init__.py28
1 files changed, 22 insertions, 6 deletions
diff --git a/synapse/metrics/__init__.py b/synapse/metrics/__init__.py
index 38408efb54..bed37b5f56 100644
--- a/synapse/metrics/__init__.py
+++ b/synapse/metrics/__init__.py
@@ -21,15 +21,14 @@ import platform
 import attr
 
 from prometheus_client import Gauge, Histogram, Counter
-from prometheus_client.core import (
-    GaugeMetricFamily, CounterMetricFamily, REGISTRY)
+from prometheus_client.core import GaugeMetricFamily, CounterMetricFamily, REGISTRY
 
 from twisted.internet import reactor
 
 
 logger = logging.getLogger(__name__)
 
-running_on_pypy = platform.python_implementation() == 'PyPy'
+running_on_pypy = platform.python_implementation() == "PyPy"
 all_metrics = []
 all_collectors = []
 all_gauges = {}
@@ -87,9 +86,16 @@ class LaterGauge(object):
 #
 
 gc_unreachable = Gauge("python_gc_unreachable_total", "Unreachable GC objects", ["gen"])
-gc_time = Histogram("python_gc_time", "Time taken to GC (ms)", ["gen"], buckets=[1, 2, 5, 10, 25, 50, 100, 250, 500, 1000])
+gc_time = Histogram(
+    "python_gc_time",
+    "Time taken to GC (ms)",
+    ["gen"],
+    buckets=[1, 2, 5, 10, 25, 50, 100, 250, 500, 1000],
+)
+
 
 class GCCounts(object):
+
     def collect(self):
         gc_counts = gc.get_count()
 
@@ -99,14 +105,23 @@ class GCCounts(object):
 
         yield cm
 
+
 REGISTRY.register(GCCounts())
 
 #
 # Twisted reactor metrics
 #
 
-tick_time = Histogram("python_twisted_reactor_tick_time", "Tick time of the Twisted reactor (ms)", buckets=[1, 2, 5, 10, 50, 100, 250, 500, 1000, 2000])
-pending_calls_metric = Histogram("python_twisted_reactor_pending_calls", "Pending calls", buckets=[1, 2, 5, 10, 25, 50, 100, 250, 500, 1000])
+tick_time = Histogram(
+    "python_twisted_reactor_tick_time",
+    "Tick time of the Twisted reactor (ms)",
+    buckets=[1, 2, 5, 10, 50, 100, 250, 500, 1000, 2000],
+)
+pending_calls_metric = Histogram(
+    "python_twisted_reactor_pending_calls",
+    "Pending calls",
+    buckets=[1, 2, 5, 10, 25, 50, 100, 250, 500, 1000],
+)
 
 #
 # Federation Metrics
@@ -134,6 +149,7 @@ event_processing_last_ts = Gauge("synapse_event_processing_last_ts", "", ["name"
 # finished being processed.
 event_processing_lag = Gauge("synapse_event_processing_lag", "", ["name"])
 
+
 def runUntilCurrentTimer(func):
 
     @functools.wraps(func)