diff --git a/pkg/chunkenc/facade.go b/pkg/chunkenc/facade.go index 24d73a9b8176..0c959a391866 100644 --- a/pkg/chunkenc/facade.go +++ b/pkg/chunkenc/facade.go @@ -77,7 +77,8 @@ func (f Facade) Size() int { if f.c == nil { return 0 } - return f.c.Size() + // Note this is an estimation (which is OK) + return f.c.CompressedSize() } // LokiChunk returns the chunkenc.Chunk. diff --git a/pkg/chunkenc/interface.go b/pkg/chunkenc/interface.go index da4b1e677ded..47b12ba3a454 100644 --- a/pkg/chunkenc/interface.go +++ b/pkg/chunkenc/interface.go @@ -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 Size() int Bytes() ([]byte, error) BytesWith([]byte) ([]byte, error) // uses provided []byte for buffer instantiation