mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
Refactoring: extract getSeriesChunks
Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
This commit is contained in:
parent
0c852680bf
commit
c75c8f8329
|
@ -200,9 +200,15 @@ func (h *headIndexReader) Series(ref storage.SeriesRef, builder *labels.ScratchB
|
||||||
|
|
||||||
*chks = (*chks)[:0]
|
*chks = (*chks)[:0]
|
||||||
|
|
||||||
|
getSeriesChunks(s, h.mint, h.maxt, chks)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func getSeriesChunks(s *memSeries, mint, maxt int64, chks *[]chunks.Meta) {
|
||||||
for i, c := range s.mmappedChunks {
|
for i, c := range s.mmappedChunks {
|
||||||
// Do not expose chunks that are outside of the specified range.
|
// Do not expose chunks that are outside of the specified range.
|
||||||
if !c.OverlapsClosedInterval(h.mint, h.maxt) {
|
if !c.OverlapsClosedInterval(mint, maxt) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
*chks = append(*chks, chunks.Meta{
|
*chks = append(*chks, chunks.Meta{
|
||||||
|
@ -223,7 +229,7 @@ func (h *headIndexReader) Series(ref storage.SeriesRef, builder *labels.ScratchB
|
||||||
} else {
|
} else {
|
||||||
maxTime = chk.maxTime
|
maxTime = chk.maxTime
|
||||||
}
|
}
|
||||||
if chk.OverlapsClosedInterval(h.mint, h.maxt) {
|
if chk.OverlapsClosedInterval(mint, maxt) {
|
||||||
*chks = append(*chks, chunks.Meta{
|
*chks = append(*chks, chunks.Meta{
|
||||||
MinTime: chk.minTime,
|
MinTime: chk.minTime,
|
||||||
MaxTime: maxTime,
|
MaxTime: maxTime,
|
||||||
|
@ -233,8 +239,6 @@ func (h *headIndexReader) Series(ref storage.SeriesRef, builder *labels.ScratchB
|
||||||
j++
|
j++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// headChunkID returns the HeadChunkID referred to by the given position.
|
// headChunkID returns the HeadChunkID referred to by the given position.
|
||||||
|
|
Loading…
Reference in a new issue