Repository navigation
feat: add stream consumer group backlog report - #74
Open
SahilRajputdotexe wants to merge 1 commit into
Open
SahilRajputdotexe wants to merge 1 commit into
SahilRajputdotexe wants to merge 1 commit into
Conversation
Add StreamGroup.PendingOwners, StreamObject.UndeliveredMessages and StreamObject.ConsumerBacklog to relate a group's pending entries to the consumers holding them, and a streambacklog command that writes the result as CSV.
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.
This adds a
streambacklogcommand that reports how far each stream consumer group is behind, read straight from an RDB file.A group keeps its pending entries as
StreamNAckvalues (id, delivery time, delivery count) and each consumer keeps its own list of pending ids, but nothing joined the two or compared message ids against the group'sLastId. This does that join inmodeland writes the result as CSV fromhelper:StreamGroup.PendingOwners()maps each pending id to the sorted consumers that hold it.StreamObject.UndeliveredMessages(group)returns the live messages above the group'sLastIdthat the group has no pending entry for, ordered by id. It compares every message's own id, since a stream entry holds many messages.StreamObject.ConsumerBacklog()returns one row per consumer with pending count, oldest delivery time and max delivery count, plus the group's undelivered count and the number of dangling pending entries (message deleted or gone). Pending entries nobody holds go into one row with an empty consumer, and a group with no pending entries still gets a row.Usage:
It takes the same options as the other reports (
-regexetc.). I added the command to both READMEs.Tests are table-driven unit tests for the three model methods, plus report tests against
cases/stream_listoacks_3.rdbandstream_listpacks_1.rdb, and an encoder-built file covering CSV quoting, key order across databases and non-stream keys being skipped.go test ./...passes in the Go workflow on my fork.