MCPcopy
hub / github.com/prometheus/prometheus / Next

Method Next

storage/buffer.go:115–141  ·  view source on GitHub ↗

Next advances the iterator to the next element.

()

Source from the content-addressed store, hash-verified

113
114// Next advances the iterator to the next element.
115func (b *BufferedSeriesIterator) Next() chunkenc.ValueType {
116 // Add current element to buffer before advancing.
117 switch b.valueType {
118 case chunkenc.ValNone:
119 return chunkenc.ValNone
120 case chunkenc.ValFloat:
121 t, f := b.it.At()
122 st := b.it.AtST()
123 b.buf.addF(fSample{st: st, t: t, f: f})
124 case chunkenc.ValHistogram:
125 t, h := b.it.AtHistogram(&b.hReader)
126 st := b.it.AtST()
127 b.buf.addH(hSample{st: st, t: t, h: h})
128 case chunkenc.ValFloatHistogram:
129 t, fh := b.it.AtFloatHistogram(&b.fhReader)
130 st := b.it.AtST()
131 b.buf.addFH(fhSample{st: st, t: t, fh: fh})
132 default:
133 panic(fmt.Errorf("BufferedSeriesIterator: unknown value type %v", b.valueType))
134 }
135
136 b.valueType = b.it.Next()
137 if b.valueType != chunkenc.ValNone {
138 b.lastTime = b.AtT()
139 }
140 return b.valueType
141}
142
143// At returns the current float element of the iterator.
144func (b *BufferedSeriesIterator) At() (int64, float64) {

Callers 2

SeekMethod · 0.95

Calls 9

AtTMethod · 0.95
addFMethod · 0.80
addHMethod · 0.80
addFHMethod · 0.80
AtMethod · 0.65
AtSTMethod · 0.65
AtHistogramMethod · 0.65
AtFloatHistogramMethod · 0.65
NextMethod · 0.65

Tested by 1