summary refs log tree commit diff
path: root/synapse/util/ratelimitutils.py
diff options
context:
space:
mode:
authorEric Eastwood <erice@element.io>2022-08-15 13:41:23 -0500
committerGitHub <noreply@github.com>2022-08-15 19:41:23 +0100
commit344a2f767c636259412f7fc2914c1554a5c4dc1d (patch)
tree71c0fc0393c7f5fe3493149b9156c62d90af2cbe /synapse/util/ratelimitutils.py
parentRevert "Update locked versions of mypy and mypy-zope (#13521)" (diff)
downloadsynapse-344a2f767c636259412f7fc2914c1554a5c4dc1d.tar.xz
Instrument `FederationStateIdsServlet` - `/state_ids` (#13499)
Instrument FederationStateIdsServlet - `/state_ids` so it's easier to follow what's going on in Jaeger when viewing a trace.
Diffstat (limited to '')
-rw-r--r--synapse/util/ratelimitutils.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/synapse/util/ratelimitutils.py b/synapse/util/ratelimitutils.py
index 6394cc39ac..e1beaec5a3 100644
--- a/synapse/util/ratelimitutils.py
+++ b/synapse/util/ratelimitutils.py
@@ -27,6 +27,7 @@ from synapse.logging.context import (
     make_deferred_yieldable,
     run_in_background,
 )
+from synapse.logging.opentracing import start_active_span
 from synapse.util import Clock
 
 if typing.TYPE_CHECKING:
@@ -176,8 +177,11 @@ class _PerHostRatelimiter:
             # Ensure that we've properly cleaned up.
             self.sleeping_requests.discard(request_id)
             self.ready_request_queue.pop(request_id, None)
+            wait_span_scope.__exit__(None, None, None)
             return r
 
+        wait_span_scope = start_active_span("ratelimit wait")
+        wait_span_scope.__enter__()
         ret_defer.addCallbacks(on_start, on_err)
         ret_defer.addBoth(on_both)
         return make_deferred_yieldable(ret_defer)