Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tsdb: expose hook to customize block querier #14114

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

yeya24
Copy link
Contributor

@yeya24 yeya24 commented May 16, 2024

In TSDB, during query time, blocks are only included or pruned based on time range and the logic is controlled in blockChunkQuerierForRange and db.Querier function.

We want to experiment with different strategies so that Querier can apply additional filtering logic in the hook based on BlockReader. See the unit test added TestBlockQuerierAndBlockChunkQuerier. The filtering can be based on metadata from the block.

Copy link
Contributor

@tjhop tjhop left a comment

Choose a reason for hiding this comment

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

Very cool 👍

tsdb/db.go Outdated
// BlockQuerierFunc is a function to return storage.Querier from a BlockReader.
BlockQuerierFunc BlockQuerierFunc

// BlockQuerierFunc is a function to return storage.ChunkQuerier from a BlockReader.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// BlockQuerierFunc is a function to return storage.ChunkQuerier from a BlockReader.
// BlockChunkQuerierFunc is a function to return storage.ChunkQuerier from a BlockReader.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, updated!

tsdb/db.go Outdated
Comment on lines 253 to 255
blockQuerierFunc func(b BlockReader, mint, maxt int64) (storage.Querier, error)

blockChunkQuerierFunc func(b BlockReader, mint, maxt int64) (storage.ChunkQuerier, error)
Copy link
Member

Choose a reason for hiding this comment

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

Why don't these use the types defined?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Make sense. Updated the code.

@yeya24 yeya24 requested a review from bboreham May 28, 2024 05:55
Signed-off-by: Ben Ye <benye@amazon.com>
Signed-off-by: Ben Ye <benye@amazon.com>
Signed-off-by: Ben Ye <benye@amazon.com>
Copy link
Member

@bboreham bboreham left a comment

Choose a reason for hiding this comment

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

LGTM

@yeya24
Copy link
Contributor Author

yeya24 commented Jun 7, 2024

Thank you @bboreham for the review. Is it ready to be merged or requires another approval? Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants