mirror of
https://github.com/element-hq/synapse.git
synced 2026-11-04 09:07:22 +00:00
The persister's entry points and stages now have spans, so the `db.*` spans of the earlier commits nest under the step that made them: - `persist.prepare_chunk` and `persist.write_chunk` (with `room_id` and `events`), created in the functions both the chunk entry points and the batch call, so they have them at every `rust_event_persistence` level; `persist.batch_next`, `persist.batch_abort` and `persist.update_current_state`; - inside a prepare: `persist.state_delta` (which includes the extremities), `persist.state_res` (with the resolution's total and database time), `persist.chain_cover`, `persist.sliding_sync` and `persist.sticky`; - inside the write transaction: `persist.txn.read`, `persist.txn.store_events`, `persist.txn.auth_chain`, `persist.txn.metadata`, `persist.txn.current_state` and `persist.txn.sliding_sync`. Most steps only queue their writes, so their spans time the step's own work, and the writes are timed in the next round trip's `db.query`. The spans are created inside the task, so their parent is the Python span active when the persist was started. `TxnTimings` stay as they are: Python still needs them for its metrics, which are not sampled. A trial test makes the test tracer the global one, as `init_tracer` does, persists a message through the Rust persister and checks what reaches the agent's UDP port: `persist.batch_next` under the persist queue's Python span and in its trace, the chunk's steps under it, and `persist.write_chunk` → `db.persist_events` → `db.connection` → `db.txn`, with the transaction's steps and `db.query` round trips carrying queued writes and the COMMIT under it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01W4zxygfJC93SsugxskhoJG