mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-25 21:54:10 -08:00
Correct size of unmarshalling destination buffer.
The format header size is not deducted from the size of the byte stream when calculating the output buffer size for samples. I have yet to notice problems directly as a result of this, but it is good to fix. Change-Id: Icb07a0718366c04ddac975d738a6305687773af0
This commit is contained in:
parent
1d01435d4d
commit
6ec72393c4
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue