mirror of
https://github.com/prometheus/prometheus.git
synced 2025-02-02 08:31:11 -08:00
Refactor assigning MinTime in histogram chunks
Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com>
This commit is contained in:
parent
3ccaaa40ba
commit
52eb303031
|
@ -840,6 +840,7 @@ func (p *populateWithDelChunkSeriesIterator) Next() bool {
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
p.curr.MinTime = p.currDelIter.AtT()
|
||||||
|
|
||||||
// Re-encode the chunk if iterator is provider. This means that it has
|
// Re-encode the chunk if iterator is provider. This means that it has
|
||||||
// some samples to be deleted or chunk is opened.
|
// some samples to be deleted or chunk is opened.
|
||||||
|
@ -855,18 +856,12 @@ func (p *populateWithDelChunkSeriesIterator) Next() bool {
|
||||||
if app, err = newChunk.Appender(); err != nil {
|
if app, err = newChunk.Appender(); err != nil {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
var h *histogram.Histogram
|
for vt := valueType; vt != chunkenc.ValNone; vt = p.currDelIter.Next() {
|
||||||
t, h = p.currDelIter.AtHistogram()
|
|
||||||
p.curr.MinTime = t
|
|
||||||
_, _, app, err = app.AppendHistogram(nil, t, h, true)
|
|
||||||
if err != nil {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
for vt := p.currDelIter.Next(); vt != chunkenc.ValNone; vt = p.currDelIter.Next() {
|
|
||||||
if vt != chunkenc.ValHistogram {
|
if vt != chunkenc.ValHistogram {
|
||||||
err = fmt.Errorf("found value type %v in histogram chunk", vt)
|
err = fmt.Errorf("found value type %v in histogram chunk", vt)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
var h *histogram.Histogram
|
||||||
t, h = p.currDelIter.AtHistogram()
|
t, h = p.currDelIter.AtHistogram()
|
||||||
_, _, app, err = app.AppendHistogram(nil, t, h, true)
|
_, _, app, err = app.AppendHistogram(nil, t, h, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -878,15 +873,12 @@ func (p *populateWithDelChunkSeriesIterator) Next() bool {
|
||||||
if app, err = newChunk.Appender(); err != nil {
|
if app, err = newChunk.Appender(); err != nil {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
var v float64
|
for vt := valueType; vt != chunkenc.ValNone; vt = p.currDelIter.Next() {
|
||||||
t, v = p.currDelIter.At()
|
|
||||||
p.curr.MinTime = t
|
|
||||||
app.Append(t, v)
|
|
||||||
for vt := p.currDelIter.Next(); vt != chunkenc.ValNone; vt = p.currDelIter.Next() {
|
|
||||||
if vt != chunkenc.ValFloat {
|
if vt != chunkenc.ValFloat {
|
||||||
err = fmt.Errorf("found value type %v in float chunk", vt)
|
err = fmt.Errorf("found value type %v in float chunk", vt)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
var v float64
|
||||||
t, v = p.currDelIter.At()
|
t, v = p.currDelIter.At()
|
||||||
app.Append(t, v)
|
app.Append(t, v)
|
||||||
}
|
}
|
||||||
|
@ -895,18 +887,12 @@ func (p *populateWithDelChunkSeriesIterator) Next() bool {
|
||||||
if app, err = newChunk.Appender(); err != nil {
|
if app, err = newChunk.Appender(); err != nil {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
var h *histogram.FloatHistogram
|
for vt := valueType; vt != chunkenc.ValNone; vt = p.currDelIter.Next() {
|
||||||
t, h = p.currDelIter.AtFloatHistogram()
|
|
||||||
p.curr.MinTime = t
|
|
||||||
_, _, app, err = app.AppendFloatHistogram(nil, t, h, true)
|
|
||||||
if err != nil {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
for vt := p.currDelIter.Next(); vt != chunkenc.ValNone; vt = p.currDelIter.Next() {
|
|
||||||
if vt != chunkenc.ValFloatHistogram {
|
if vt != chunkenc.ValFloatHistogram {
|
||||||
err = fmt.Errorf("found value type %v in histogram chunk", vt)
|
err = fmt.Errorf("found value type %v in histogram chunk", vt)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
var h *histogram.FloatHistogram
|
||||||
t, h = p.currDelIter.AtFloatHistogram()
|
t, h = p.currDelIter.AtFloatHistogram()
|
||||||
_, _, app, err = app.AppendFloatHistogram(nil, t, h, true)
|
_, _, app, err = app.AppendFloatHistogram(nil, t, h, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue