Repository navigation
Conversation
Each ChatMachine.Update is one transaction that locks the chat row, runs one or more transitions, and commits. Two histograms now record every Update, labelled by the transitions the callback ran (joined by '+') and whether it committed or rolled back: coderd_chatd_transition_duration_seconds lock attempt to commit coderd_chatd_transition_phase_seconds one series per phase The phase label splits each Update into pre_lock (BeginTx, including any wait for a pooled connection), lock_wait (the row lock statement), callback (statements run while holding the row), and commit (COMMIT or ROLLBACK). The counts give the number of transactions per turn by shape, lock_wait shows which shapes queue behind other transitions on the same chat, and callback is the time each shape holds the lock. Acquire, Abandon, and ReconcileInvalidState validate without requireFromAllowed, so every transition records its name through Tx.enter rather than only the ones that go through the matrix check.
This was referenced Oct 1, 2026
Contributor
Docs previewCheck off each page once it's been reviewed. If a page changes in a later push, its checkbox clears automatically so it gets a fresh look. Pages not yet wired into the docs navigation aren't listed here. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Each
ChatMachine.Updateis one transaction that locks the chat row, runs one or more transitions, and commits. This records everyUpdatein two histograms labelled by the transitions the callback ran (joined by+) and the outcome (committedorrolled_back):coderd_chatd_transition_duration_seconds, andcoderd_chatd_transition_phase_secondswith aphaselabel ofpre_lock(BeginTx, including any wait for a pooled connection),lock_wait(the row lock statement),callback(statements run while holding the row), andcommit. Acquire, Abandon, and ReconcileInvalidState do not validate through the matrix check, so every transition now records its name throughTx.enterinstead of landing undernone.Database impact: none; the histograms are in-process. The point is attribution:
lock_waitshows which transition shapes queue behind others on the same chat, andcallbackis the lock hold time, which is what the rest of this series shortens. Landing this first lets each later PR be measured on its own.Combined with the other PRs: overlaps textually with #30267 (both edit
Txand the lock statement inUpdate; the phase timing wraps whichever lock call is there) and with #30269 (Metrics.observegainsoutcome="lock_unavailable"forErrChatLocked); whichever merges second carries those lines.Series: #30264 harness jitter, #30265 transition metrics, #30266 lock-free stream reads, #30267 single-write transitions, #30268 commit-write result and RBAC cache, #30269 non-blocking acquisition, #30270 finish turn in the step commit.
Generated by Coder Agents on behalf of @cstyan.