-
Notifications
You must be signed in to change notification settings - Fork 177
[WIP] Add Chunks method to Series interface. #659
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -54,6 +54,9 @@ type Series interface { | |
|
|
||
| // Iterator returns a new iterator of the data of the series. | ||
| Iterator() SeriesIterator | ||
|
|
||
| // Chunks returns a copy of the compressed chunks that make up this series. | ||
| Chunks() []chunks.Meta | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I know iterator interface is sometimes bit controversial (e.g very hard to read and debug), but especially for remote read use case it might be actually more valuable to have it in
Does it mean we guarantee ALL implementations to return chunks with
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Proposed iterators here: #665 (: Let me know if this makes sense.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the iterator approach is better. |
||
| } | ||
|
|
||
| // querier aggregates querying results from time blocks within | ||
|
|
@@ -876,6 +879,10 @@ func (s *chunkSeries) Iterator() SeriesIterator { | |
| return newChunkSeriesIterator(s.chunks, s.intervals, s.mint, s.maxt) | ||
| } | ||
|
|
||
| func (s *chunkSeries) Chunks() []chunks.Meta { | ||
| return s.chunks | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is that a copy of chunks as comment suggests? I think it is exactly the same underlying array passed around. |
||
| } | ||
|
|
||
| // SeriesIterator iterates over the data of a time series. | ||
| type SeriesIterator interface { | ||
| // Seek advances the iterator forward to the given timestamp. | ||
|
|
@@ -904,6 +911,14 @@ func (s *chainedSeries) Iterator() SeriesIterator { | |
| return newChainedSeriesIterator(s.series...) | ||
| } | ||
|
|
||
| func (s *chainedSeries) Chunks() []chunks.Meta { | ||
| var chunks []chunks.Meta | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Size of the slice can be preallocated to |
||
| for _, s := range s.series { | ||
| chunks = append(s.Chunks()) | ||
| } | ||
| return chunks | ||
| } | ||
|
|
||
| // chainedSeriesIterator implements a series iterater over a list | ||
| // of time-sorted, non-overlapping iterators. | ||
| type chainedSeriesIterator struct { | ||
|
|
@@ -961,6 +976,14 @@ func (it *chainedSeriesIterator) Err() error { | |
| return it.cur.Err() | ||
| } | ||
|
|
||
| func (s *verticalChainedSeries) Chunks() []chunks.Meta { | ||
| var chunks []chunks.Meta | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Size of the slice can be preallocated to |
||
| for _, s := range s.series { | ||
| chunks = append(s.Chunks()) | ||
| } | ||
| return chunks | ||
| } | ||
|
|
||
| // verticalChainedSeries implements a series for a list of time-sorted, time-overlapping series. | ||
| // They all must have the same labels. | ||
| type verticalChainedSeries struct { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worth to mention that we iterate here over raw samples?
SeriesIteratordoes not tell that.