Skip to content

[fix][broker] Fix bucket delayed message index metrics reset on scrape#26171

Merged
nodece merged 1 commit into
apache:masterfrom
nodece:fix-bucket-metrics
Jul 10, 2026
Merged

[fix][broker] Fix bucket delayed message index metrics reset on scrape#26171
nodece merged 1 commit into
apache:masterfrom
nodece:fix-bucket-metrics

Conversation

@nodece

@nodece nodece commented Jul 9, 2026

Copy link
Copy Markdown
Member

Motivation

BucketDelayedMessageIndexStats used LongAdder.sumThenReset() for operation
counts and StatsBuckets.refresh() for latency buckets. Since both reset their
internal counters after reading, every stats collection cleared the accumulated
metrics. As a result, both topic stats and exported metrics only reported values
from the first read after new operations, while subsequent reads returned zero
until more operations occurred.

Modifications

  • Add StatsBuckets.snapshot() to read cumulative values without resetting
    internal counters.
  • Switch BucketDelayedMessageIndexStats to use cumulative reads for operation
    counts and latency buckets.
  • Add tests covering repeated stats collection.

@nodece nodece merged commit c240dd2 into apache:master Jul 10, 2026
44 checks passed
@nodece nodece deleted the fix-bucket-metrics branch July 10, 2026 02:41
@nodece nodece added this to the 5.0.0-M2 milestone Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants