Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions pkg/chunk/encoding/varbit.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ func (c *varbitChunk) Slice(_, _ model.Time) Chunk {

// Marshal implements chunk.
func (c varbitChunk) Marshal(w io.Writer) error {
size := c.marshalLen()
size := c.Size()
n, err := w.Write(c[:size])
if err != nil {
return err
Expand Down Expand Up @@ -327,9 +327,6 @@ func (MarshalConfig) RegisterFlags(f *flag.FlagSet) {

// marshalLen returns the number of bytes that should be marshalled for this chunk
func (c varbitChunk) marshalLen() int {
if alwaysMarshalFullsizeChunks {
return cap(c)
}
bits := c.nextSampleOffset()
if bits < varbitThirdSampleBitOffset {
bits = varbitThirdSampleBitOffset
Expand All @@ -351,6 +348,9 @@ func (c varbitChunk) Len() int {
}

func (c varbitChunk) Size() int {
if alwaysMarshalFullsizeChunks {
return cap(c)
}
return c.marshalLen()
}

Expand Down