mirror of
https://mau.dev/maunium/synapse.git
synced 2024-10-01 01:36:05 -04:00
Fix inflight requests metric (incorrect name & traceback) (#3413)
This commit is contained in:
parent
ccfdaf68be
commit
f6c4d74f96
@ -117,13 +117,17 @@ def _get_in_flight_counts():
|
|||||||
Returns:
|
Returns:
|
||||||
dict[tuple[str, str], int]
|
dict[tuple[str, str], int]
|
||||||
"""
|
"""
|
||||||
for rm in _in_flight_requests:
|
# Cast to a list to prevent it changing while the Prometheus
|
||||||
|
# thread is collecting metrics
|
||||||
|
reqs = list(_in_flight_requests)
|
||||||
|
|
||||||
|
for rm in reqs:
|
||||||
rm.update_metrics()
|
rm.update_metrics()
|
||||||
|
|
||||||
# Map from (method, name) -> int, the number of in flight requests of that
|
# Map from (method, name) -> int, the number of in flight requests of that
|
||||||
# type
|
# type
|
||||||
counts = {}
|
counts = {}
|
||||||
for rm in _in_flight_requests:
|
for rm in reqs:
|
||||||
key = (rm.method, rm.name,)
|
key = (rm.method, rm.name,)
|
||||||
counts[key] = counts.get(key, 0) + 1
|
counts[key] = counts.get(key, 0) + 1
|
||||||
|
|
||||||
@ -131,7 +135,7 @@ def _get_in_flight_counts():
|
|||||||
|
|
||||||
|
|
||||||
LaterGauge(
|
LaterGauge(
|
||||||
"synapse_http_request_metrics_in_flight_requests_count",
|
"synapse_http_server_in_flight_requests_count",
|
||||||
"",
|
"",
|
||||||
["method", "servlet"],
|
["method", "servlet"],
|
||||||
_get_in_flight_counts,
|
_get_in_flight_counts,
|
||||||
|
Loading…
Reference in New Issue
Block a user