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
Feat: Get block by id directly on promtool analyze & get latest block if ID not provided #12031
Merged
+83
−18
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nidhey27
force-pushed
the
issue-10822
branch
5 times, most recently
from
March 6, 2023 10:48
de6e437
to
09e27ee
Compare
nidhey27
changed the title
(WIP) Feat: Get block by id directly on promtool analyze & get latest block if ID not provided
Feat: Get block by id directly on promtool analyze & get latest block if ID not provided
Mar 9, 2023
codesome
reviewed
Apr 5, 2023
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.
Thanks for your work on this! There is some room for improvement which should hopefully be fairly straightforward :)
nidhey27
force-pushed
the
issue-10822
branch
3 times, most recently
from
April 6, 2023 08:55
ea8fca6
to
aaabced
Compare
codesome
reviewed
Apr 25, 2023
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.
Last few comments
codesome
reviewed
Apr 26, 2023
Signed-off-by: nidhey27 <nidhey.indurkar@infracloud.io>
Signed-off-by: nidhey60@gmail.com <nidhey.indurkar@infracloud.io>
Signed-off-by: nidhey60@gmail.com <nidhey.indurkar@infracloud.io>
codesome
approved these changes
Jun 1, 2023
bboreham
pushed a commit
to bboreham/prometheus
that referenced
this pull request
Jul 24, 2023
… if ID not provided (prometheus#12031) * feat: analyze latest block or block by ID in CLI (promtool) Signed-off-by: nidhey27 <nidhey.indurkar@infracloud.io> * address remarks Signed-off-by: nidhey60@gmail.com <nidhey.indurkar@infracloud.io> * address latest review comments Signed-off-by: nidhey60@gmail.com <nidhey.indurkar@infracloud.io> --------- Signed-off-by: nidhey27 <nidhey.indurkar@infracloud.io> Signed-off-by: nidhey60@gmail.com <nidhey.indurkar@infracloud.io>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Explanation
The program currently loads all blocks when a user tries to analyze a block using a BlockID, which can be time-consuming as the block size increases. Additionally, if a BlockID is not provided, the program still retrieves all blocks before analyzing the latest one.
The Block(), LastBlockID(), and lastBlockDirName() functions have been implemented. These functions analyze a block by BlockID. If no BlockID is provided, they analyze the latest block.
Related PR
PR 11528 Status - Open
Related Issue
Closes #10822
Proposed Changes
Existing code:
openBlock()
called byanalyzeBlock()
usesBlocks()
function which returns slice ofBlockReaders
.Block()
takes up BlockID and analyses that particular block.If BlockID is not provided by user then
LastBlockID()
will get the BlockID for last block in the tsdb storage with the help oflastBlockDirName()
Unit test case for this feat is implemented.
Proof Manifests
CLI Output
With BlockID
Without BlockID
Test Case output
When BlockID is passed
When BlockID is not passed