Skip to content
This repository was archived by the owner on Aug 13, 2019. It is now read-only.

[WIP] Add Chunks method to Series interface. - #659

Closed
tomwilkie wants to merge 1 commit into
masterfrom
add-chunks-to-queriers
Closed

[WIP] Add Chunks method to Series interface.#659
tomwilkie wants to merge 1 commit into
masterfrom
add-chunks-to-queriers

Conversation

@tomwilkie

Copy link
Copy Markdown
Contributor

Signed-off-by: Tom Wilkie tom.wilkie@gmail.com

This is to enable Cortex to use TSDB, and so the remote_read API doesn't need to re-encode chunks.

/cc @bwplotka.

TODO

  • CHANGELOG
  • Tests

Signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
@tomwilkie tomwilkie changed the title Add Chunks method to Series interface. [WIP] Add Chunks method to Series interface. Jul 11, 2019
@tomwilkie
tomwilkie requested a review from bwplotka July 11, 2019 17:10
Comment thread querier.go
}

func (s *chainedSeries) Chunks() []chunks.Meta {
var chunks []chunks.Meta

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Size of the slice can be preallocated to len(s.series)

Comment thread querier.go
}

func (s *verticalChainedSeries) Chunks() []chunks.Meta {
var chunks []chunks.Meta

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Size of the slice can be preallocated to len(s.series)

Comment thread querier.go
@@ -54,6 +54,9 @@ type Series interface {

// Iterator returns a new iterator of the data of the series.

Copy link
Copy Markdown
Contributor

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? SeriesIterator does not tell that.

@bwplotka bwplotka left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @tomwilkie ! Super happy this is happening, but I think we might want ChunkIterator instead? 🤔

Comment thread querier.go
}

func (s *chunkSeries) Chunks() []chunks.Meta {
return s.chunks

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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.

Comment thread querier.go
Iterator() SeriesIterator

// Chunks returns a copy of the compressed chunks that make up this series.
Chunks() []chunks.Meta

@bwplotka bwplotka Jul 16, 2019

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think Chunks is breaking the consistency here a bit, becaue we have Iterator above so maybe ChunksIterator would be more appropriate? and have ChunkIterator iterator that iterates over chunks.

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 iterator. This is to otentially avoid allocating the whole slice of chunks within Series interface implementation once we compose the frame. For Cortex use case, I am not sure as you just mentioned: This is to enable Cortex to use TSDB What do you think?

of the compressed chunks

Does it mean we guarantee ALL implementations to return chunks with chunks.Meta.Bytes and not only Ref? I don't think we can guarantee that so we might want to add or ref to chunk in chunk file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Proposed iterators here: #665 (: Let me know if this makes sense.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the iterator approach is better.

@bwplotka

Copy link
Copy Markdown
Contributor

Proposed alternative: #665

@tomwilkie

Copy link
Copy Markdown
Contributor Author

Closing for the alternative.

@tomwilkie tomwilkie closed this Aug 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants