mirror of
https://github.com/prometheus/prometheus
synced 2024-12-23 23:13:11 +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.
|
||||
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 c.err = iter.Err(); c.err != nil {
|
||||
return false
|
||||
|
@ -204,9 +204,7 @@ func (c *seriesSetToChunkSet) Next() bool {
|
||||
}
|
||||
|
||||
func (c *seriesSetToChunkSet) At() ChunkSeries {
|
||||
return &seriesToChunkEncoder{
|
||||
Series: c.SeriesSet.At(),
|
||||
}
|
||||
return NewSeriesToChunkEncoder(c.SeriesSet.At())
|
||||
}
|
||||
|
||||
func (c *seriesSetToChunkSet) Err() error {
|
||||
@ -219,6 +217,11 @@ type seriesToChunkEncoder struct {
|
||||
|
||||
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 {
|
||||
chk := chunkenc.NewXORChunk()
|
||||
app, err := chk.Appender()
|
||||
|
Loading…
Reference in New Issue
Block a user