mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 21:44:52 -04:00
cleanups, self-registration
This commit is contained in:
parent
a8990fa2ec
commit
8f5a688d42
3 changed files with 12 additions and 19 deletions
|
@ -71,24 +71,14 @@ in_flight_requests_db_sched_duration = Counter("synapse_http_request_in_flight_r
|
|||
_in_flight_requests = set()
|
||||
|
||||
|
||||
def _collect_in_flight():
|
||||
"""Called just before metrics are collected, so we use it to update all
|
||||
the in flight request metrics
|
||||
"""
|
||||
|
||||
for rm in _in_flight_requests:
|
||||
rm.update_metrics()
|
||||
|
||||
|
||||
metrics.register_collector(_collect_in_flight)
|
||||
|
||||
|
||||
def _get_in_flight_counts():
|
||||
"""Returns a count of all in flight requests by (method, server_name)
|
||||
|
||||
Returns:
|
||||
dict[tuple[str, str], int]
|
||||
"""
|
||||
for rm in _in_flight_requests:
|
||||
rm.update_metrics()
|
||||
|
||||
# Map from (method, name) -> int, the number of in flight requests of that
|
||||
# type
|
||||
|
@ -99,6 +89,7 @@ def _get_in_flight_counts():
|
|||
|
||||
return counts
|
||||
|
||||
|
||||
LaterGauge(
|
||||
"synapse_http_request_metrics_in_flight_requests_count", "",
|
||||
["method", "servlet"],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue