Repository navigation
Verbose tracing emits marten.append.event on every append route (#5772) - #5782
Merged
Merged
Conversation
With TrackConnections = Verbose, marten.append.event was emitted only for an operation deriving from Weasel.Storage.AppendEventOperationBase, which only Rich mode's per-event appends are. Neither Quick route was traced: - the bulk mt_quick_append_events operation (QuickAppendEventsOperationBase), which carries a whole stream and is the V9 default's route for almost every append. The tracer now emits one event per event in its stream. - the per-event Quick append that reads its seq_id back (weasel#747, since #5755), used by a Quick-mode StartStream. Weasel's type is internal and not an AppendEventOperationBase, so under Verbose tracing Marten now wraps it in TracedQuickAppendEventOperation, which exposes the event. Nothing is wrapped below Verbose. Closes #5772 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 29, 2026
Open
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.
Closes #5772.
Problem
With
TrackConnections = TrackLevel.Verbose,EventTracingConnectionLifetime.writeVerboseEventsemittedmarten.append.eventonly for operations deriving fromWeasel.Storage.AppendEventOperationBase. Both Quick routes fell through, and theirRole()isEvents, so the fallback branch skipped them too:QuickAppendEventsOperationBasehandles onemt_quick_append_eventscall per stream. UnderQuickWithServerTimestamps, the V9 default, nearly every append andStartStreamgoes through it.QuickAppendEventWithVersionReadingSequenceOperationisinternalto Weasel and implementsIStorageOperationdirectly. It is what a Quick-modeStartStreamuses (and the daemon's side-effect appends).Fix
AppendEventOperationBase: one event, as before.QuickAppendEventsOperationBase: one event per event in itsStreamAction.TracedQuickAppendEventOperation: one event.TracedQuickAppendEventOperationis a Marten wrapper around Weasel's per-event Quick operation that exposesEvent/Stream.ClosedShapeEventDocumentStorage.QuickAppendEventWithVersionwraps only whenTrackConnections == Verbose(fixed at store construction), and only an operation that is neither anAppendEventOperationBasenor aNoDataReturnedCall. Below Verbose nothing is wrapped and nothing changes. The wrapper forwardsConfigureCommand,PostprocessAsync(so theseq_idread-back still happens),Role,DocumentType,TryTransformandToString. Like the wrapped operation, it is not aNoDataReturnedCall.The cleaner long-term shape is a public interface in Weasel for per-event append operations, which the tracer could check instead of the wrapper. That needs a Weasel release, so this PR doesn't wait on it.
Tests
CoreTests/Bugs/Bug_5772_verbose_tracing_of_quick_appendscaptures themarten.connectionactivity underVerbose. It asserts exactly onemarten.append.eventper appended event, in order, across Rich, Quick and QuickWithServerTimestamps, for bothStartStreamandAppend. The QuickStartStreamcase also asserts every event'sSequencewas still read back through the wrapper.Run locally on net10.0 / PG17:
Bug_5772*,EventTracingConnectionLifetimeTests,marten_activity_parentingandBug_3911*, 30/30 pass.Not covered by a test: the daemon side-effect append path, which uses the same
QuickAppendEventWithVersionand so gets the same wrapping.No public API change.
🤖 Generated with Claude Code