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

fixes chunk size method in facade #3981

Merged
merged 1 commit into from
Jul 19, 2021

Conversation

owen-d
Copy link
Member

@owen-d owen-d commented Jul 9, 2021

I noticed we've misrepresented the Chunk.Size method across Loki & Cortex. Loki uses this to describe the chunk's entry count, while Cortex uses this to describe the byte size. You can see this by comparing the following two metrics:

sum(rate(loki_ingester_chunk_size_bytes_sum[1m]))
vs
sum(rate(cortex_chunk_store_stored_chunk_bytes_total[1m]))

This hasn't hurt us asides from misaligning metrics, but it's good to fix.

@@ -111,6 +111,7 @@ type Chunk interface {
SampleIterator(ctx context.Context, from, through time.Time, extractor log.StreamSampleExtractor) iter.SampleIterator
// Returns the list of blocks in the chunks.
Blocks(mintT, maxtT time.Time) []Block
// Size returns the number of entries in a chunk
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm confused by the comment ? Should it be the size of the 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.

Copy link
Contributor

Choose a reason for hiding this comment

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

Should you fix the comment ? That's where I'm confused.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think the comment is fixed - we use chunkenc.Chunk's Size() method to give the number of entries. This is different from Cortex's Chunk type, which the Facade now correctly accounts for.

I can also change the method name, but I figured this was the least intrusive change.

Copy link
Contributor

@cyriltovena cyriltovena left a comment

Choose a reason for hiding this comment

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

LGTM

@owen-d owen-d merged commit 2107148 into grafana:main Jul 19, 2021
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.

None yet

2 participants