diff --git a/storage/metric/sample.go b/storage/metric/sample.go index fff0f9d9c9..f6016625f4 100644 --- a/storage/metric/sample.go +++ b/storage/metric/sample.go @@ -171,7 +171,7 @@ func (v Values) marshal() []byte { // unmarshalValues decodes marshalled samples and returns them as Values. func unmarshalValues(buf []byte) Values { - n := len(buf) / sampleSize + n := (len(buf) - formatVersionSize) / sampleSize // Setting the value of a given slice index is around 15% faster than doing // an append, even if the slice already has the required capacity. For this // reason, we already set the full target length here.