Use VarbitUint rather than VarbitInt to encode len(spans)

Signed-off-by: beorn7 <beorn@grafana.com>
This commit is contained in:
beorn7 2021-10-15 15:25:35 +02:00
parent 3179215a59
commit d31bb75dc4

View file

@ -56,7 +56,7 @@ func readHistogramChunkLayout(b *bstreamReader) (
} }
func putHistogramChunkLayoutSpans(b *bstream, spans []histogram.Span) { func putHistogramChunkLayoutSpans(b *bstream, spans []histogram.Span) {
putVarbitInt(b, int64(len(spans))) putVarbitUint(b, uint64(len(spans)))
for _, s := range spans { for _, s := range spans {
putVarbitUint(b, uint64(s.Length)) putVarbitUint(b, uint64(s.Length))
putVarbitInt(b, int64(s.Offset)) putVarbitInt(b, int64(s.Offset))
@ -65,7 +65,7 @@ func putHistogramChunkLayoutSpans(b *bstream, spans []histogram.Span) {
func readHistogramChunkLayoutSpans(b *bstreamReader) ([]histogram.Span, error) { func readHistogramChunkLayoutSpans(b *bstreamReader) ([]histogram.Span, error) {
var spans []histogram.Span var spans []histogram.Span
num, err := readVarbitInt(b) num, err := readVarbitUint(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }