summary refs log tree commit diff
path: root/synapse/util/metrics.py
diff options
context:
space:
mode:
authorSean Quah <8349537+squahtx@users.noreply.github.com>2021-11-17 19:07:02 +0000
committerGitHub <noreply@github.com>2021-11-17 19:07:02 +0000
commit84fac0f814f69645ff1ad564ef8294b31203dc95 (patch)
tree041505d9f8711a230ac6e11c707ff19017f038c0 /synapse/util/metrics.py
parentAdd support for `/_matrix/media/v3` APIs (#11371) (diff)
downloadsynapse-84fac0f814f69645ff1ad564ef8294b31203dc95.tar.xz
Add type annotations to `synapse.metrics` (#10847)
Diffstat (limited to '')
-rw-r--r--synapse/util/metrics.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/synapse/util/metrics.py b/synapse/util/metrics.py
index ad775dfc7d..98ee49af6e 100644
--- a/synapse/util/metrics.py
+++ b/synapse/util/metrics.py
@@ -56,8 +56,15 @@ block_db_sched_duration = Counter(
     "synapse_util_metrics_block_db_sched_duration_seconds", "", ["block_name"]
 )
 
+
+# This is dynamically created in InFlightGauge.__init__.
+class _InFlightMetric(Protocol):
+    real_time_max: float
+    real_time_sum: float
+
+
 # Tracks the number of blocks currently active
-in_flight = InFlightGauge(
+in_flight: InFlightGauge[_InFlightMetric] = InFlightGauge(
     "synapse_util_metrics_block_in_flight",
     "",
     labels=["block_name"],
@@ -65,12 +72,6 @@ in_flight = InFlightGauge(
 )
 
 
-# This is dynamically created in InFlightGauge.__init__.
-class _InFlightMetric(Protocol):
-    real_time_max: float
-    real_time_sum: float
-
-
 T = TypeVar("T", bound=Callable[..., Any])