Skip to content

add metric for monitor max queued record num shard - #905

Open
flashmouse wants to merge 2 commits into
confluentinc:masterfrom
flashmouse:add-shards-metric
Open

add metric for monitor max queued record num shard#905
flashmouse wants to merge 2 commits into
confluentinc:masterfrom
flashmouse:add-shards-metric

Conversation

@flashmouse

Copy link
Copy Markdown
Contributor

I want to add a metric to monitor the maximum number of queued records for the shard. This metric is especially useful for orderType.KEY. If this metric is high and all messages are consumed at the same speed, it implies that some shards may contain a hot key with lots of records.

Checklist

  • Documentation (if applicable)
  • Changelog

@flashmouse
flashmouse requested a review from a team as a code owner January 4, 2026 09:59
Antony Stubbs (astubbs) added a commit to astubbs/parallel-consumer that referenced this pull request Apr 18, 2026
…onfluentinc#905)

Cherry-pick of confluentinc#905 (author: flashmouse).

Adds a SHARDS_MAX_SIZE gauge that reports the record count in the
most-loaded shard. Useful with KEY ordering to detect hot-key
bottlenecks. Also simplifies .keySet().size() to .size().

Upstream PR: confluentinc#905

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Antony Stubbs (astubbs) added a commit to astubbs/parallel-consumer that referenced this pull request Apr 18, 2026
…onfluentinc#905)

Cherry-pick of confluentinc#905 (author: flashmouse).

Adds a SHARDS_MAX_SIZE gauge that reports the record count in the
most-loaded shard. Useful with KEY ordering to detect hot-key
bottlenecks. Also simplifies .keySet().size() to .size().

Upstream PR: confluentinc#905

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Antony Stubbs (astubbs) added a commit to astubbs/parallel-consumer that referenced this pull request Apr 20, 2026
…onfluentinc#905)

Cherry-pick of confluentinc#905 (author: flashmouse).

Adds a SHARDS_MAX_SIZE gauge that reports the record count in the
most-loaded shard. Useful with KEY ordering to detect hot-key
bottlenecks. Also simplifies .keySet().size() to .size().

Upstream PR: confluentinc#905

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Antony Stubbs (astubbs) added a commit to astubbs/parallel-consumer that referenced this pull request Apr 20, 2026
…onfluentinc#905)

Cherry-pick of confluentinc#905 (author: flashmouse).

Adds a SHARDS_MAX_SIZE gauge that reports the record count in the
most-loaded shard. Useful with KEY ordering to detect hot-key
bottlenecks. Also simplifies .keySet().size() to .size().

Upstream PR: confluentinc#905

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Antony Stubbs (astubbs) added a commit to astubbs/parallel-consumer that referenced this pull request Apr 20, 2026
…onfluentinc#905)

Cherry-pick of confluentinc#905 (author: flashmouse).

Adds a SHARDS_MAX_SIZE gauge that reports the record count in the
most-loaded shard. Useful with KEY ordering to detect hot-key
bottlenecks. Also simplifies .keySet().size() to .size().

Upstream PR: confluentinc#905

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Antony Stubbs (astubbs) added a commit to astubbs/parallel-consumer that referenced this pull request Apr 20, 2026
…onfluentinc#905)

Cherry-pick of confluentinc#905 (author: flashmouse).

Adds a SHARDS_MAX_SIZE gauge that reports the record count in the
most-loaded shard. Useful with KEY ordering to detect hot-key
bottlenecks. Also simplifies .keySet().size() to .size().

Upstream PR: confluentinc#905

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Antony Stubbs (astubbs) added a commit to astubbs/parallel-consumer that referenced this pull request Apr 20, 2026
…onfluentinc#905)

Cherry-pick of confluentinc#905 (author: flashmouse).

Adds a SHARDS_MAX_SIZE gauge that reports the record count in the
most-loaded shard. Useful with KEY ordering to detect hot-key
bottlenecks. Also simplifies .keySet().size() to .size().

Upstream PR: confluentinc#905

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Antony Stubbs (astubbs) added a commit to astubbs/parallel-consumer that referenced this pull request Apr 21, 2026
…onfluentinc#905)

Cherry-pick of confluentinc#905 (author: flashmouse).

Adds a SHARDS_MAX_SIZE gauge that reports the record count in the
most-loaded shard. Useful with KEY ordering to detect hot-key
bottlenecks. Also simplifies .keySet().size() to .size().

Upstream PR: confluentinc#905

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Antony Stubbs (astubbs) added a commit to astubbs/parallel-consumer that referenced this pull request Apr 21, 2026
…onfluentinc#905)

Cherry-pick of confluentinc#905 (author: flashmouse).

Adds a SHARDS_MAX_SIZE gauge that reports the record count in the
most-loaded shard. Useful with KEY ordering to detect hot-key
bottlenecks. Also simplifies .keySet().size() to .size().

Upstream PR: confluentinc#905

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Antony Stubbs (astubbs) added a commit to astubbs/parallel-consumer that referenced this pull request Jul 28, 2026
Add a "Parallel-safe work while PR #57 is in flight" section to
docs/inflight.md recording, for each in-flight track, whether it
collides with PR #57's metrics/state files (857, 909, 51 -> sequence
after) or is parallel-safe (912, release, logging cleanup, security
bumps, contributor fixes, #40, confluentinc#915, DLQ), ranked by readiness.

Also refresh the confluentinc#859 entry to the consolidated PR #57 (bundles the
confluentinc#893/confluentinc#905 cherry-picks, supersedes the closed #42->#43->#45 stack) and
expand the confluentinc#912 entry (ready, pushed, no PR, vertx-isolated). Bump the
last-updated date.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Antony Stubbs (astubbs) added a commit to astubbs/parallel-consumer that referenced this pull request Jul 28, 2026
Add a "Parallel-safe work while PR #57 is in flight" section to
docs/inflight.md recording, for each in-flight track, whether it
collides with PR #57's metrics/state files (857, 909, 51 -> sequence
after) or is parallel-safe (912, release, logging cleanup, security
bumps, contributor fixes, #40, confluentinc#915, DLQ), ranked by readiness.

Also refresh the confluentinc#859 entry to the consolidated PR #57 (bundles the
confluentinc#893/confluentinc#905 cherry-picks, supersedes the closed #42->#43->#45 stack) and
expand the confluentinc#912 entry (ready, pushed, no PR, vertx-isolated). Bump the
last-updated date.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Antony Stubbs (astubbs) added a commit to astubbs/parallel-consumer that referenced this pull request Jul 28, 2026
…onfluentinc#905)

Cherry-pick of confluentinc#905 (author: flashmouse).

Adds a SHARDS_MAX_SIZE gauge that reports the record count in the
most-loaded shard. Useful with KEY ordering to detect hot-key
bottlenecks. Also simplifies .keySet().size() to .size().

Upstream PR: confluentinc#905

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Antony Stubbs (astubbs) added a commit to astubbs/parallel-consumer that referenced this pull request Jul 28, 2026
Render backlink comments from an optional per-entry backlink field in
upstream-map.yaml (source of truth) instead of a separate body, with the same
{{FORK_REPO}}/{{FORK_REF}}/{{SUMMARY}}/{{ID}} placeholders; entries without it
fall back to the generic templates. bug-859 uses it to explain the two-cause
leak vs the already-merged upstream confluentinc#892.

Make fork status honest about landed-ness. The old "fixed" conflated "fix
written" with "shipped": every "fixed" entry is actually an OPEN, unmerged fork
PR (or a branch with no PR). Replace with a lifecycle vocabulary
(none|in-progress|ready|pr-open|merged|released|superseded|wontfix) and correct
the entries: confluentinc#859/confluentinc#893/confluentinc#905 -> pr-open (in open PR #57), confluentinc#857 -> ready
(branch-only). Add an optional per-entry todo: list for outstanding actions
(merge the open PR, post the backlink) surfaced by "upstream-map.py todo", so
"still to do" is explicit rather than implied by an open PR + null forwarded.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Antony Stubbs (astubbs) added a commit to astubbs/parallel-consumer that referenced this pull request Jul 28, 2026
…tus guard

Audited PR #57 against issue confluentinc#859. The code matches the issue (registeredMeters
List -> LinkedHashSet + prune, plus caching OffsetMapCodecManager in
PartitionStateManager), but the wording framed the leak as rebalance-driven when
the issue is commit-driven. Tighten bug-859 summary/notes/backlink: the List
accumulated a duplicate Meter.Id on every registration (every commit); fork PR
#57 fixes it via List->Set + PartitionStateManager caching (also closes confluentinc#233);
upstream confluentinc#892 covers the per-commit churn; confluentinc#893/confluentinc#905 are unrelated cherry-picks.

Also fix upstream-backlink.sh: the fix-backlink status guard still checked the
removed "fixed" value, so it refused every entry after the lifecycle-status
change. Now allows ready|pr-open|merged|released and refuses none|in-progress.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Antony Stubbs (astubbs) added a commit to astubbs/parallel-consumer that referenced this pull request Jul 28, 2026
The description repeated itself ("queued records in the shards with the most
queued records"). State it plainly: the maximum records queued in any single
(most-loaded) shard.

Upstream-PR: confluentinc#905

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Antony Stubbs (astubbs) added a commit to astubbs/parallel-consumer that referenced this pull request Jul 28, 2026
…onfluentinc#905)

Cherry-pick of confluentinc#905 (author: flashmouse).

Adds a SHARDS_MAX_SIZE gauge that reports the record count in the
most-loaded shard. Useful with KEY ordering to detect hot-key
bottlenecks. Also simplifies .keySet().size() to .size().

Upstream PR: confluentinc#905

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Antony Stubbs (astubbs) added a commit to astubbs/parallel-consumer that referenced this pull request Jul 28, 2026
The description repeated itself ("queued records in the shards with the most
queued records"). State it plainly: the maximum records queued in any single
(most-loaded) shard.

Upstream-PR: confluentinc#905

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Antony Stubbs (astubbs) added a commit to astubbs/parallel-consumer that referenced this pull request Jul 28, 2026
Record the user-visible changes this PR introduces under the unreleased 0.6.0.0
section: the PCMetrics memory-leak fix, the accurate-committed-offset fix, and
the new shards.max.size metric. Follows the fork/upstream reference convention.

Upstream-Issue: confluentinc#859
Upstream-PR: confluentinc#893
Upstream-PR: confluentinc#905

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Antony Stubbs (astubbs) added a commit to astubbs/parallel-consumer that referenced this pull request Jul 28, 2026
Add docs/runbooks/pr57-post-merge.md - the exact, reviewed upstream comments to
post after #57 merges: the confluentinc#859 fix-backlink (from the manifest backlink field),
and tailored author-crediting notes for the carried confluentinc#893/confluentinc#905 PRs (the generic
template is wrong for cherry-picked PRs), plus the manifest status flips.

Update AGENTS.md backlink guidance: always pre-draft backlinks as a runbook
committed to the PR - reviewable in-diff, tailored per target, context-aware
across targets - rather than running the backlink script blind. Runbooks live in
docs/runbooks/, deleted once executed; stragglers swept at the next major release.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Antony Stubbs (astubbs) added a commit to astubbs/parallel-consumer that referenced this pull request Jul 28, 2026
Add docs/runbooks/pr57-post-merge.md - the exact, reviewed upstream comments to
post after #57 merges: the confluentinc#859 fix-backlink (from the manifest backlink field),
and tailored author-crediting notes for the carried confluentinc#893/confluentinc#905 PRs (the generic
template is wrong for cherry-picked PRs), plus the manifest status flips.

Update AGENTS.md backlink guidance: always pre-draft backlinks as a runbook
committed to the PR - reviewable in-diff, tailored per target, context-aware
across targets - rather than running the backlink script blind. Runbooks live in
docs/runbooks/, deleted once executed; stragglers swept at the next major release.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Antony Stubbs (astubbs) added a commit to astubbs/parallel-consumer that referenced this pull request Jul 28, 2026
Add docs/runbooks/pr57-post-merge.md - the exact, reviewed upstream comments to
post after #57 merges: the confluentinc#859 fix-backlink (from the manifest backlink field),
and tailored author-crediting notes for the carried confluentinc#893/confluentinc#905 PRs (the generic
template is wrong for cherry-picked PRs), plus the manifest status flips.

Update AGENTS.md backlink guidance: always pre-draft backlinks as a runbook
committed to the PR - reviewable in-diff, tailored per target, context-aware
across targets - rather than running the backlink script blind. Runbooks live in
docs/runbooks/, deleted once executed; stragglers swept at the next major release.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Antony Stubbs (astubbs) added a commit to astubbs/parallel-consumer that referenced this pull request Jul 29, 2026
Cover the new max-queued-records-per-shard metric next to the existing SHARDS_SIZE assertion in PCMetricsTest - the larger of the two per-partition shard remainders.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Antony Stubbs (astubbs) added a commit to astubbs/parallel-consumer that referenced this pull request Jul 29, 2026
…ntinc#905 gauge perf

Two review findings: static errorPolicy is set-once since #57, so multiple PC instances in one JVM with differing InvalidOffsetMetadataHandlingPolicy would all use the last-constructed policy (fix via instance field, part of the confluentinc#233 de-static work); and the SHARDS_MAX_SIZE gauge re-walks shard queues, duplicating the SHARDS_SIZE traversal (negligible).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant