mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-14 08:33:48 +01:00
Instrument get_metadata_for_events
for tracing (#13730)
When backfilling, `_get_state_ids_after_missing_prev_event` calls [`get_metadata_for_events`](26bc26586b/synapse/handlers/federation_event.py (L1133)
). For `#matrix:matrix.org`, it's called with 77k `state_events` which means 77 calls to the database and takes 28 seconds.
This commit is contained in:
parent
8d7fcf9b76
commit
d4d3249ded
2 changed files with 3 additions and 0 deletions
1
changelog.d/13730.misc
Normal file
1
changelog.d/13730.misc
Normal file
|
@ -0,0 +1 @@
|
|||
Instrument `get_metadata_for_events` for understandable traces in Jaeger.
|
|
@ -23,6 +23,7 @@ from synapse.api.errors import NotFoundError, UnsupportedRoomVersionError
|
|||
from synapse.api.room_versions import KNOWN_ROOM_VERSIONS, RoomVersion
|
||||
from synapse.events import EventBase
|
||||
from synapse.events.snapshot import EventContext
|
||||
from synapse.logging.opentracing import trace
|
||||
from synapse.storage._base import SQLBaseStore
|
||||
from synapse.storage.database import (
|
||||
DatabasePool,
|
||||
|
@ -143,6 +144,7 @@ class StateGroupWorkerStore(EventsWorkerStore, SQLBaseStore):
|
|||
|
||||
return room_version
|
||||
|
||||
@trace
|
||||
async def get_metadata_for_events(
|
||||
self, event_ids: Collection[str]
|
||||
) -> Dict[str, EventMetadata]:
|
||||
|
|
Loading…
Reference in a new issue