mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-06 15:44:10 -04:00
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.
This commit is contained in:
parent
793d03e2c5
commit
ae01a7edd3
8 changed files with 67 additions and 18 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue