diff options
author | Andrew Morgan <andrew@amorgan.xyz> | 2021-12-07 10:36:37 +0000 |
---|---|---|
committer | Andrew Morgan <andrew@amorgan.xyz> | 2021-12-07 10:36:37 +0000 |
commit | c0b157dc9bcc88ea77704bc7b07c11e250212376 (patch) | |
tree | 87ba8914960c8d4d0351b9e329407c5e06956775 /synapse/util/metrics.py | |
parent | Modify tests to handle new location of to-device messages in AS txns (diff) | |
parent | Stabilise support for MSC2918 refresh tokens as they have now been merged int... (diff) | |
download | synapse-c0b157dc9bcc88ea77704bc7b07c11e250212376.tar.xz |
Merge branch 'develop' of github.com:matrix-org/synapse into anoa/e2e_as_to_device
Diffstat (limited to 'synapse/util/metrics.py')
-rw-r--r-- | synapse/util/metrics.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/synapse/util/metrics.py b/synapse/util/metrics.py index 1e784b3f1f..98ee49af6e 100644 --- a/synapse/util/metrics.py +++ b/synapse/util/metrics.py @@ -56,14 +56,22 @@ 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"], sub_metrics=["real_time_max", "real_time_sum"], ) + T = TypeVar("T", bound=Callable[..., Any]) @@ -180,7 +188,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 |