diff options
Diffstat (limited to 'synapse/util/metrics.py')
-rw-r--r-- | synapse/util/metrics.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/synapse/util/metrics.py b/synapse/util/metrics.py index 1e784b3f1f..ad775dfc7d 100644 --- a/synapse/util/metrics.py +++ b/synapse/util/metrics.py @@ -64,6 +64,13 @@ in_flight = InFlightGauge( sub_metrics=["real_time_max", "real_time_sum"], ) + +# This is dynamically created in InFlightGauge.__init__. +class _InFlightMetric(Protocol): + real_time_max: float + real_time_sum: float + + T = TypeVar("T", bound=Callable[..., Any]) @@ -180,7 +187,7 @@ class Measure: """ return self._logging_context.get_resource_usage() - def _update_in_flight(self, metrics) -> None: + def _update_in_flight(self, metrics: _InFlightMetric) -> None: """Gets called when processing in flight metrics""" assert self.start is not None duration = self.clock.time() - self.start |