mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-09 15:14:04 -08:00
storage: add AtT
method to MemoizedSeriesIterator
Signed-off-by: Charles Korn <charles.korn@grafana.com>
This commit is contained in:
parent
52a73ec871
commit
2ca4d16236
|
@ -136,6 +136,11 @@ func (b *MemoizedSeriesIterator) AtFloatHistogram() (int64, *histogram.FloatHist
|
|||
return b.it.AtFloatHistogram(nil)
|
||||
}
|
||||
|
||||
// AtT returns the timestamp of the current element of the iterator.
|
||||
func (b *MemoizedSeriesIterator) AtT() int64 {
|
||||
return b.it.AtT()
|
||||
}
|
||||
|
||||
// Err returns the last encountered error.
|
||||
func (b *MemoizedSeriesIterator) Err() error {
|
||||
return b.it.Err()
|
||||
|
|
|
@ -29,13 +29,15 @@ func TestMemoizedSeriesIterator(t *testing.T) {
|
|||
sampleEq := func(ets int64, ev float64, efh *histogram.FloatHistogram) {
|
||||
if efh == nil {
|
||||
ts, v := it.At()
|
||||
require.Equal(t, ets, ts, "timestamp mismatch")
|
||||
require.Equal(t, ev, v, "value mismatch")
|
||||
require.Equal(t, ets, ts, "At() timestamp mismatch")
|
||||
require.Equal(t, ev, v, "At() value mismatch")
|
||||
} else {
|
||||
ts, fh := it.AtFloatHistogram()
|
||||
require.Equal(t, ets, ts, "timestamp mismatch")
|
||||
require.Equal(t, efh, fh, "histogram mismatch")
|
||||
require.Equal(t, ets, ts, "AtFloatHistogram() timestamp mismatch")
|
||||
require.Equal(t, efh, fh, "AtFloatHistogram() histogram mismatch")
|
||||
}
|
||||
|
||||
require.Equal(t, ets, it.AtT(), "AtT() timestamp mismatch")
|
||||
}
|
||||
prevSampleEq := func(ets int64, ev float64, efh *histogram.FloatHistogram, eok bool) {
|
||||
ts, v, fh, ok := it.PeekPrev()
|
||||
|
|
Loading…
Reference in a new issue