summary refs log tree commit diff
path: root/synapse/handlers/federation.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2021-08-02 14:30:46 +0100
committerErik Johnston <erik@matrix.org>2021-08-02 14:30:46 +0100
commit0ee0d7b4602edd4a755ba7c5257b86c70cd5683a (patch)
treebe808a88bb8f76b09a0521b759fc934dd3118749 /synapse/handlers/federation.py
parentAllow setting transaction limit for db connections (#10440) (diff)
downloadsynapse-0ee0d7b4602edd4a755ba7c5257b86c70cd5683a.tar.xz
Add extra spans to remote join path
Diffstat (limited to '')
-rw-r--r--synapse/handlers/federation.py32
1 files changed, 18 insertions, 14 deletions
diff --git a/synapse/handlers/federation.py b/synapse/handlers/federation.py
index 8197b60b76..2e94852a72 100644
--- a/synapse/handlers/federation.py
+++ b/synapse/handlers/federation.py
@@ -72,6 +72,7 @@ from synapse.logging.context import (
     preserve_fn,
     run_in_background,
 )
+from synapse.logging.opentracing import start_active_span
 from synapse.logging.utils import log_function
 from synapse.metrics.background_process_metrics import run_as_background_process
 from synapse.replication.http.devices import ReplicationUserDevicesResyncRestServlet
@@ -1462,14 +1463,15 @@ class FederationHandler(BaseHandler):
 
         logger.debug("Joining %s to %s", joinee, room_id)
 
-        origin, event, room_version_obj = await self._make_and_verify_event(
-            target_hosts,
-            room_id,
-            joinee,
-            "join",
-            content,
-            params={"ver": KNOWN_ROOM_VERSIONS},
-        )
+        with start_active_span("make_join"):
+            origin, event, room_version_obj = await self._make_and_verify_event(
+                target_hosts,
+                room_id,
+                joinee,
+                "join",
+                content,
+                params={"ver": KNOWN_ROOM_VERSIONS},
+            )
 
         # This shouldn't happen, because the RoomMemberHandler has a
         # linearizer lock which only allows one operation per user per room
@@ -1490,9 +1492,10 @@ class FederationHandler(BaseHandler):
             except ValueError:
                 pass
 
-            ret = await self.federation_client.send_join(
-                host_list, event, room_version_obj
-            )
+            with start_active_span("send_join"):
+                ret = await self.federation_client.send_join(
+                    host_list, event, room_version_obj
+                )
 
             event = ret.event
             origin = ret.origin
@@ -1519,9 +1522,10 @@ class FederationHandler(BaseHandler):
                 room_version=room_version_obj,
             )
 
-            max_stream_id = await self._persist_auth_tree(
-                origin, room_id, auth_chain, state, event, room_version_obj
-            )
+            with start_active_span("_persist_auth_tree"):
+                max_stream_id = await self._persist_auth_tree(
+                    origin, room_id, auth_chain, state, event, room_version_obj
+                )
 
             # We wait here until this instance has seen the events come down
             # replication (if we're using replication) as the below uses caches.