summary refs log tree commit diff
path: root/synapse/metrics/_gc.py
diff options
context:
space:
mode:
authorRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2022-04-06 13:59:04 +0100
committerGitHub <noreply@github.com>2022-04-06 12:59:04 +0000
commitae01a7edd32c8a4650700294c50a37385fa07984 (patch)
treedadb535ee33aad957b0fb6625026c42df5a1aa77 /synapse/metrics/_gc.py
parentGenerate historic pagination token for `/messages` when no `?from` token prov... (diff)
downloadsynapse-ae01a7edd32c8a4650700294c50a37385fa07984.tar.xz
Update type annotations for compatiblity with prometheus_client 0.14 (#12389)
Principally, `prometheus_client.REGISTRY.register` now requires its argument to
extend `prometheus_client.Collector`.

Additionally, `Gauge.set` is now annotated so that passing `Optional[int]`
causes an error.
Diffstat (limited to 'synapse/metrics/_gc.py')
-rw-r--r--synapse/metrics/_gc.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/synapse/metrics/_gc.py b/synapse/metrics/_gc.py
index 2bc909efa0..b7d47ce3e7 100644
--- a/synapse/metrics/_gc.py
+++ b/synapse/metrics/_gc.py
@@ -30,6 +30,8 @@ from prometheus_client.core import (
 
 from twisted.internet import task
 
+from synapse.metrics._types import Collector
+
 """Prometheus metrics for garbage collection"""
 
 
@@ -71,7 +73,7 @@ gc_time = Histogram(
 )
 
 
-class GCCounts:
+class GCCounts(Collector):
     def collect(self) -> Iterable[Metric]:
         cm = GaugeMetricFamily("python_gc_counts", "GC object counts", labels=["gen"])
         for n, m in enumerate(gc.get_count()):
@@ -135,7 +137,7 @@ def install_gc_manager() -> None:
 #
 
 
-class PyPyGCStats:
+class PyPyGCStats(Collector):
     def collect(self) -> Iterable[Metric]:
 
         # @stats is a pretty-printer object with __str__() returning a nice table,