diff options
author | Amber Brown <hawkowl@atleastfornow.net> | 2018-06-20 11:18:57 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-20 11:18:57 +0100 |
commit | f6c4d74f9687aaaa7a3cecfdcd65b365633fd96c (patch) | |
tree | 181458857645632a2b375f06053459136f8c687c /synapse | |
parent | spell gauge correctly (diff) | |
download | synapse-f6c4d74f9687aaaa7a3cecfdcd65b365633fd96c.tar.xz |
Fix inflight requests metric (incorrect name & traceback) (#3413)
Diffstat (limited to 'synapse')
-rw-r--r-- | synapse/http/request_metrics.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/synapse/http/request_metrics.py b/synapse/http/request_metrics.py index dc06f6c443..1b711ca2de 100644 --- a/synapse/http/request_metrics.py +++ b/synapse/http/request_metrics.py @@ -117,13 +117,17 @@ def _get_in_flight_counts(): Returns: 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() # Map from (method, name) -> int, the number of in flight requests of that # type counts = {} - for rm in _in_flight_requests: + for rm in reqs: key = (rm.method, rm.name,) counts[key] = counts.get(key, 0) + 1 @@ -131,7 +135,7 @@ def _get_in_flight_counts(): LaterGauge( - "synapse_http_request_metrics_in_flight_requests_count", + "synapse_http_server_in_flight_requests_count", "", ["method", "servlet"], _get_in_flight_counts, |