summary refs log tree commit diff
path: root/synapse/state
diff options
context:
space:
mode:
authorEric Eastwood <erice@element.io>2023-05-19 12:26:58 -0500
committerGitHub <noreply@github.com>2023-05-19 12:26:58 -0500
commit703a8f9c67cfe25b956dfdcca654818d52fa7ebd (patch)
treeb2d15c474c2020c0541083cc20e33344fefe1e7f /synapse/state
parentTrace how many new events from the backfill response we need to process (#15633) (diff)
downloadsynapse-703a8f9c67cfe25b956dfdcca654818d52fa7ebd.tar.xz
Instrument `state` and `state_group` storage related things (tracing) (#15610)
Instrument `state` and `state_group` storage related things (tracing) so it's a little more clear where these database transactions are coming from as there is a lot of wires crossing in these functions.

Part of `/messages` performance investigation: https://github.com/matrix-org/synapse/issues/13356
Diffstat (limited to 'synapse/state')
-rw-r--r--synapse/state/__init__.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/synapse/state/__init__.py b/synapse/state/__init__.py
index 6031095249..9bc0c3b7b9 100644
--- a/synapse/state/__init__.py
+++ b/synapse/state/__init__.py
@@ -45,6 +45,7 @@ from synapse.events.snapshot import (
     UnpersistedEventContextBase,
 )
 from synapse.logging.context import ContextResourceUsage
+from synapse.logging.opentracing import tag_args, trace
 from synapse.replication.http.state import ReplicationUpdateCurrentStateRestServlet
 from synapse.state import v1, v2
 from synapse.storage.databases.main.events_worker import EventRedactBehaviour
@@ -270,6 +271,8 @@ class StateHandler:
         state = await entry.get_state(self._state_storage_controller, StateFilter.all())
         return await self.store.get_joined_hosts(room_id, state, entry)
 
+    @trace
+    @tag_args
     async def calculate_context_info(
         self,
         event: EventBase,
@@ -465,6 +468,7 @@ class StateHandler:
 
         return await unpersisted_context.persist(event)
 
+    @trace
     @measure_func()
     async def resolve_state_groups_for_events(
         self, room_id: str, event_ids: Collection[str], await_full_state: bool = True