summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2018-07-24 10:41:51 +0100
committerGitHub <noreply@github.com>2018-07-24 10:41:51 +0100
commit2601ee28bd18d31c2848855ab79a31db661a917e (patch)
treede741f41f37c02db51544e8cbe7661b5324e3c3c /synapse
parentMerge pull request #3584 from matrix-org/erikj/use_cached (diff)
parentchangelog (diff)
downloadsynapse-2601ee28bd18d31c2848855ab79a31db661a917e.tar.xz
Merge pull request #3590 from matrix-org/rav/persist_events_metrics
Add some measure blocks to persist_events
Diffstat (limited to 'synapse')
-rw-r--r--synapse/storage/events.py32
1 files changed, 21 insertions, 11 deletions
diff --git a/synapse/storage/events.py b/synapse/storage/events.py
index c2910094d0..392935cacf 100644
--- a/synapse/storage/events.py
+++ b/synapse/storage/events.py
@@ -417,19 +417,29 @@ class EventsStore(EventsWorkerStore):
                             logger.info(
                                 "Calculating state delta for room %s", room_id,
                             )
-                            current_state = yield self._get_new_state_after_events(
-                                room_id,
-                                ev_ctx_rm,
-                                latest_event_ids,
-                                new_latest_event_ids,
-                            )
+
+                            with Measure(
+                                    self._clock,
+                                    "persist_events.get_new_state_after_events",
+                            ):
+                                current_state = yield self._get_new_state_after_events(
+                                    room_id,
+                                    ev_ctx_rm,
+                                    latest_event_ids,
+                                    new_latest_event_ids,
+                                )
+
                             if current_state is not None:
                                 current_state_for_room[room_id] = current_state
-                                delta = yield self._calculate_state_delta(
-                                    room_id, current_state,
-                                )
-                                if delta is not None:
-                                    state_delta_for_room[room_id] = delta
+                                with Measure(
+                                        self._clock,
+                                        "persist_events.calculate_state_delta",
+                                ):
+                                    delta = yield self._calculate_state_delta(
+                                        room_id, current_state,
+                                    )
+                                    if delta is not None:
+                                        state_delta_for_room[room_id] = delta
 
                 yield self.runInteraction(
                     "persist_events",