chore(statement-store): add console.info diagnostics for batch and submit lifecycle#155
Open
duewarn wants to merge 1 commit into
Open
chore(statement-store): add console.info diagnostics for batch and submit lifecycle#155duewarn wants to merge 1 commit into
duewarn wants to merge 1 commit into
Conversation
…bmit lifecycle Adds structured logs at the four observable transitions of an outgoing batch and the response-arrival path: - `outgoing batch START — 1 message (no pending)` when a fresh batch is created. - `outgoing batch APPEND — N messages now (previous batch had no response yet)` when a new message piggybacks on an unacknowledged batch (peer hasn't ACKed yet) and the whole thing is re-submitted under a new requestId. - `outgoing batch FULL — message queued, N in queue` when the new message would push the batch past `maxRequestSize` and gets parked in the queue until the current batch settles. - `response received — N pending message(s) in batch will be resolved` when a response statement matches the current outgoing batch and pending deliveries are about to fire. Adds an optional `globalThis.__registerStatementStoreTopicLabel` hook called from `ensureStoreSubscription` with `peer-incoming` and `self-outgoing` labels for the session's incoming and outgoing topics. A host app that wraps `subscribeStatements` for diagnostics can use these labels to render readable subscription IDs instead of opaque hex. The hook is undefined by default; host apps that don't install it are unaffected. No behaviour change. Useful when triaging slow/dropped peer responses on a session.
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.
Summary
Adds structured logs at the four observable transitions of an outgoing batch and the response-arrival path.
Logs added
outgoing batch START — 1 message (no pending)— fresh batch createdoutgoing batch APPEND — N messages now (previous batch had no response yet)— new message piggybacks on an unacknowledged batchoutgoing batch FULL — message queued, N in queue— message parked waiting for current batch to settleresponse received — N pending message(s) in batch will be resolved— response statement matches the current outgoing batchTopic-label hook
Adds an optional
globalThis.__registerStatementStoreTopicLabelhook called fromensureStoreSubscriptionwithpeer-incomingandself-outgoinglabels for the session's incoming and outgoing topics. A host app that wrapssubscribeStatementsfor diagnostics can render readable subscription IDs (e.g.sub#1[peer-incoming]) from these labels. The hook is undefined by default; host apps that don't install it are unaffected.Related
chore/signing-flow-logs— installs the topic-label hook and renders the labels in its statement-store wrapper.Test plan
vitest run packages/statement-store— 29 passed