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 in tsdb to allow customizing compactor #14113

Merged
merged 2 commits into from
Jun 4, 2024

Conversation

yeya24
Copy link
Contributor

@yeya24 yeya24 commented May 16, 2024

This PR tries to expose a hook in TSDB to allow downstream projects which uses TSDB as a library to customize their own compactor implementation. If no hook is provided, by default the leveled compactor is used. There is no change for Prometheus project itself.

Also added a test case to cover the usage of the hook.

Signed-off-by: Ben Ye <benye@amazon.com>
@yeya24
Copy link
Contributor Author

yeya24 commented May 28, 2024

Can you please take a look? @jesusvazquez Thanks

@beorn7 beorn7 requested a review from codesome June 4, 2024 15:45
@beorn7
Copy link
Member

beorn7 commented Jun 4, 2024

@codesome plans to do the final review here (but @jesusvazquez you are more than welcome, too, of course).

Copy link
Member

@codesome codesome left a comment

Choose a reason for hiding this comment

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

LGTM. Nits on the comment.

tsdb/db.go Outdated
@@ -189,8 +189,13 @@ type Options struct {

// EnableSharding enables query sharding support in TSDB.
EnableSharding bool

// NewCompactorFunc is a function which initializes a TSDB compactor.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// NewCompactorFunc is a function which initializes a TSDB compactor.
// NewCompactorFunc is a function that returns a TSDB compactor.
// This overrides the default compactor if set.

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 the comment.

Signed-off-by: Ben Ye <benye@amazon.com>
@codesome codesome merged commit 8a08f45 into prometheus:main Jun 4, 2024
24 checks passed
@yeya24 yeya24 deleted the expose-new-compactor-func branch June 4, 2024 23:20
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

4 participants