Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(metrics): Properly split large buckets repeatedly #3893

Merged
merged 3 commits into from
Aug 2, 2024

Conversation

jan-auer
Copy link
Member

@jan-auer jan-auer commented Aug 2, 2024

A bug in BucketView::split causes an endless loop when splitting a bucket more
than once. Split did not honor the index of the last split and repeatedly
returned the same view on subsequent calls.

This function is used when sending global metric partitions, which causes high
request volume and backlogs when large buckets are ingested.

@jan-auer jan-auer requested a review from a team as a code owner August 2, 2024 14:45
let Range { start, end } = self.range.clone();
SplitDecision::Split(n) => {
let Range { start, end } = self.range;
let at = start + n;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the actual fix.

/// - `MoveToNextBatch` if the size budget cannot even hold the bucket name and tags. There is no
/// split, the entire bucket is moved.
/// - `Split(at)` if the bucket fits partially, the bucket should be split `at`.
/// - `Split(n)` if the bucket fits partially, the bucket should be split after `n` elements.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change in documentation along with the remaining renaming should help to avoid this mistake going forward.

@jan-auer jan-auer self-assigned this Aug 2, 2024
@jan-auer jan-auer enabled auto-merge (squash) August 2, 2024 14:52
@jan-auer jan-auer merged commit bcbfa7e into master Aug 2, 2024
24 checks passed
@jan-auer jan-auer deleted the fix/split-large-buckets branch August 2, 2024 15:07
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.

3 participants