mirror of
https://github.com/prometheus/prometheus
synced 2025-01-11 08:59:37 +00:00
expose seriesToChunkEncoder (#8845)
Signed-off-by: yeya24 <yb532204897@gmail.com>
This commit is contained in:
parent
e6bb865ad4
commit
d95b097250
@ -667,7 +667,7 @@ func (c *compactChunkIterator) Next() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add last as it's not yet included in overlap. We operate on same series, so labels does not matter here.
|
// Add last as it's not yet included in overlap. We operate on same series, so labels does not matter here.
|
||||||
iter = (&seriesToChunkEncoder{Series: c.mergeFunc(append(overlapping, newChunkToSeriesDecoder(nil, c.curr))...)}).Iterator()
|
iter = NewSeriesToChunkEncoder(c.mergeFunc(append(overlapping, newChunkToSeriesDecoder(nil, c.curr))...)).Iterator()
|
||||||
if !iter.Next() {
|
if !iter.Next() {
|
||||||
if c.err = iter.Err(); c.err != nil {
|
if c.err = iter.Err(); c.err != nil {
|
||||||
return false
|
return false
|
||||||
|
@ -204,9 +204,7 @@ func (c *seriesSetToChunkSet) Next() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *seriesSetToChunkSet) At() ChunkSeries {
|
func (c *seriesSetToChunkSet) At() ChunkSeries {
|
||||||
return &seriesToChunkEncoder{
|
return NewSeriesToChunkEncoder(c.SeriesSet.At())
|
||||||
Series: c.SeriesSet.At(),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *seriesSetToChunkSet) Err() error {
|
func (c *seriesSetToChunkSet) Err() error {
|
||||||
@ -219,6 +217,11 @@ type seriesToChunkEncoder struct {
|
|||||||
|
|
||||||
const seriesToChunkEncoderSplit = 120
|
const seriesToChunkEncoderSplit = 120
|
||||||
|
|
||||||
|
// NewSeriesToChunkEncoder encodes samples to chunks with 120 samples limit.
|
||||||
|
func NewSeriesToChunkEncoder(series Series) ChunkSeries {
|
||||||
|
return &seriesToChunkEncoder{series}
|
||||||
|
}
|
||||||
|
|
||||||
func (s *seriesToChunkEncoder) Iterator() chunks.Iterator {
|
func (s *seriesToChunkEncoder) Iterator() chunks.Iterator {
|
||||||
chk := chunkenc.NewXORChunk()
|
chk := chunkenc.NewXORChunk()
|
||||||
app, err := chk.Appender()
|
app, err := chk.Appender()
|
||||||
|
Loading…
Reference in New Issue
Block a user