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

Better combines stats in ingesters #9474

Merged
merged 1 commit into from
May 18, 2023

Conversation

owen-d
Copy link
Member

@owen-d owen-d commented May 17, 2023

  • Reduces double counting streams when possible
  • proportionally add stats based on chunk overlap range
  • code reuse

…reams in instance stats + some code reuse

Signed-off-by: Owen Diehl <ow.diehl@gmail.com>
@owen-d owen-d requested a review from a team as a code owner May 17, 2023 17:51
@@ -584,12 +584,17 @@ func (i *instance) GetStats(ctx context.Context, req *logproto.IndexStatsRequest
chkFrom, chkThrough := chk.chunk.Bounds()

if !chk.flushed.Equal(zeroValueTime) && from.Before(chkThrough) && through.After(chkFrom) {
Copy link
Contributor

@DylanGuedes DylanGuedes May 17, 2023

Choose a reason for hiding this comment

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

double checking: shouldn't here be from.Before(chkThrough) || through.After(chkFrom) as it is a partial overlap?
Ex:
edit: ok I suck at doing ascii art

	//       From ______ chkFrom____Through____chkThrough|             
	//       │____________|_______ Chunk _____________│       

Copy link
Member Author

Choose a reason for hiding this comment

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

from.Before(chkThrough) && through.After(chkFrom) can only be true when there's some degree of overlap with the time range and chunk. In your ascii example that holds true. If we used || instead of &&, it would include potentially non-overlapping ranges.

Copy link
Contributor

@salvacorts salvacorts left a comment

Choose a reason for hiding this comment

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

LGTM. Approving to unblock but I think we should add a test for this if possible.

@owen-d owen-d merged commit 64c6f6b into grafana:main May 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants