summary refs log tree commit diff
path: root/synapse/metrics/_reactor_metrics.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/_reactor_metrics.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/_reactor_metrics.py')
-rw-r--r--synapse/metrics/_reactor_metrics.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/synapse/metrics/_reactor_metrics.py b/synapse/metrics/_reactor_metrics.py
index f38f798313..a2c6e6842d 100644
--- a/synapse/metrics/_reactor_metrics.py
+++ b/synapse/metrics/_reactor_metrics.py
@@ -21,6 +21,8 @@ from prometheus_client.core import REGISTRY, GaugeMetricFamily
 
 from twisted.internet import reactor
 
+from synapse.metrics._types import Collector
+
 #
 # Twisted reactor metrics
 #
@@ -54,7 +56,7 @@ class EpollWrapper:
         return getattr(self._poller, item)
 
 
-class ReactorLastSeenMetric:
+class ReactorLastSeenMetric(Collector):
     def __init__(self, epoll_wrapper: EpollWrapper):
         self._epoll_wrapper = epoll_wrapper