mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-25 05:34:05 -08:00
Add TODOs and some minor tweaks
Signed-off-by: beorn7 <beorn@grafana.com>
This commit is contained in:
parent
c8b267efd6
commit
8f92c90897
|
@ -1767,7 +1767,7 @@ func (ev *evaluator) matrixIterSlice(it *storage.BufferedSeriesIterator, mint, m
|
|||
}
|
||||
}
|
||||
}
|
||||
// The seeked sample might also be in the range.
|
||||
// The sought sample might also be in the range.
|
||||
if ok {
|
||||
if it.ChunkEncoding() == chunkenc.EncHistogram {
|
||||
t, h := it.HistogramValues()
|
||||
|
|
|
@ -87,6 +87,7 @@ type Point struct {
|
|||
}
|
||||
|
||||
func (p Point) String() string {
|
||||
// TODO(beorn7): Support Histogram.
|
||||
v := strconv.FormatFloat(p.V, 'f', -1, 64)
|
||||
return fmt.Sprintf("%v @[%v]", v, p.T)
|
||||
}
|
||||
|
@ -299,11 +300,9 @@ func (ssi *storageSeriesIterator) At() (t int64, v float64) {
|
|||
return p.T, p.V
|
||||
}
|
||||
|
||||
// AtHistogram always returns (0, histogram.Histogram{}) because there is no
|
||||
// support for histogram values yet.
|
||||
// TODO(beorn7): Fix that for histogram support in PromQL.
|
||||
func (ssi *storageSeriesIterator) AtHistogram() (int64, histogram.Histogram) {
|
||||
return 0, histogram.Histogram{}
|
||||
p := ssi.points[ssi.curr]
|
||||
return p.T, *p.H
|
||||
}
|
||||
|
||||
func (ssi *storageSeriesIterator) ChunkEncoding() chunkenc.Encoding {
|
||||
|
|
|
@ -230,8 +230,6 @@ func (it *sampleRingIterator) At() (int64, float64) {
|
|||
return it.r.at(it.i)
|
||||
}
|
||||
|
||||
// AtHistogram always returns (0, histogram.Histogram{}) because there is no
|
||||
// support for histogram values yet.
|
||||
func (it *sampleRingIterator) AtHistogram() (int64, histogram.Histogram) {
|
||||
return it.r.atHistogram(it.i)
|
||||
}
|
||||
|
|
|
@ -216,11 +216,11 @@ func newFakeSeriesIterator(nsamples, step int64) *fakeSeriesIterator {
|
|||
}
|
||||
|
||||
func (it *fakeSeriesIterator) At() (int64, float64) {
|
||||
return it.idx * it.step, 123 // value doesn't matter
|
||||
return it.idx * it.step, 123 // Value doesn't matter.
|
||||
}
|
||||
|
||||
func (it *fakeSeriesIterator) AtHistogram() (int64, histogram.Histogram) {
|
||||
return it.idx * it.step, histogram.Histogram{} // value doesn't matter
|
||||
return it.idx * it.step, histogram.Histogram{} // Value doesn't matter.
|
||||
}
|
||||
|
||||
func (it *fakeSeriesIterator) ChunkEncoding() chunkenc.Encoding {
|
||||
|
|
|
@ -91,10 +91,9 @@ func (it *listSeriesIterator) At() (int64, float64) {
|
|||
return s.T(), s.V()
|
||||
}
|
||||
|
||||
// AtHistogram always returns (0, histogram.Histogram{}) because there is no
|
||||
// support for histogram values yet.
|
||||
func (it *listSeriesIterator) AtHistogram() (int64, histogram.Histogram) {
|
||||
return 0, histogram.Histogram{}
|
||||
s := it.samples.Get(it.idx)
|
||||
return s.T(), *s.H()
|
||||
}
|
||||
|
||||
func (it *listSeriesIterator) ChunkEncoding() chunkenc.Encoding {
|
||||
|
|
|
@ -89,6 +89,8 @@ type Appender interface {
|
|||
// Iterator iterates over the samples of a time series, in timestamp-increasing order.
|
||||
type Iterator interface {
|
||||
// Next advances the iterator by one.
|
||||
// TODO(beorn7): Perhaps this should return if the next value is a float or a histogram
|
||||
// to make it easier calling the right method (At vs AtHistogram)?
|
||||
Next() bool
|
||||
// Seek advances the iterator forward to the first sample with the timestamp equal or greater than t.
|
||||
// If current sample found by previous `Next` or `Seek` operation already has this property, Seek has no effect.
|
||||
|
@ -100,6 +102,7 @@ type Iterator interface {
|
|||
At() (int64, float64)
|
||||
// AtHistogram returns the current timestamp/histogram pair.
|
||||
// Before the iterator has advanced AtHistogram behaviour is unspecified.
|
||||
// TODO(beorn7): Maybe return *histogram.Histogram? It's a fairly large struct.
|
||||
AtHistogram() (int64, histogram.Histogram)
|
||||
// Err returns the current error. It should be used only after iterator is
|
||||
// exhausted, that is `Next` or `Seek` returns false.
|
||||
|
|
|
@ -166,6 +166,7 @@ func (it *sampleRingIterator) At() (int64, float64) {
|
|||
}
|
||||
|
||||
func (it *sampleRingIterator) AtHistogram() (int64, histogram.Histogram) {
|
||||
// TODO(beorn7): Add proper histogram support.
|
||||
return 0, histogram.Histogram{}
|
||||
}
|
||||
|
||||
|
|
|
@ -153,7 +153,11 @@ func (it *listSeriesIterator) At() (int64, float64) {
|
|||
}
|
||||
|
||||
func (it *listSeriesIterator) AtHistogram() (int64, histogram.Histogram) {
|
||||
return 0, histogram.Histogram{}
|
||||
s := it.list[it.idx]
|
||||
if s.h == nil {
|
||||
return s.t, histogram.Histogram{}
|
||||
}
|
||||
return s.t, *s.h
|
||||
}
|
||||
|
||||
func (it *listSeriesIterator) ChunkEncoding() chunkenc.Encoding {
|
||||
|
|
Loading…
Reference in a new issue