-
Notifications
You must be signed in to change notification settings - Fork 313
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(index): distinguish different types of index metrics #4337
feat(index): distinguish different types of index metrics #4337
Conversation
Signed-off-by: Zhenchi <zhongzc_arch@outlook.com>
WalkthroughThe recent updates primarily focus on enhancing metrics tracking and struct initialization in the Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (5)
- src/mito2/src/metrics.rs (1 hunks)
- src/mito2/src/sst/index.rs (3 hunks)
- src/mito2/src/sst/index/fulltext_index/creator.rs (2 hunks)
- src/mito2/src/sst/index/inverted_index/creator.rs (2 hunks)
- src/mito2/src/sst/index/statistics.rs (4 hunks)
Additional comments not posted (12)
src/mito2/src/sst/index/statistics.rs (4)
31-32
: Addition ofindex_type
field is appropriate.The inclusion of the
index_type
field allows for better granularity in metrics tracking.
46-55
: New method initialization is correct.The
new
method initializes theindex_type
field along with other fields, ensuring proper setup of theStatistics
struct.
89-108
: Drop implementation updates are correct.The updated
Drop
implementation correctly includesindex_type
in its metric observations, ensuring accurate tracking.
Line range hint
163-178
:
Test case addition is appropriate.The test case verifies the basic functionality of the
Statistics
struct, including the newindex_type
field.src/mito2/src/sst/index/fulltext_index/creator.rs (2)
39-39
: Initialization withTYPE_FULLTEXT_INDEX
is appropriate.The change ensures that the
Statistics
struct is initialized with the correct index type.
108-108
: Initialization withTYPE_FULLTEXT_INDEX
is appropriate.The change ensures that the
Statistics
struct is initialized with the correct index type.src/mito2/src/metrics.rs (1)
212-234
: Metrics update to useIntCounterVec
andIntGaugeVec
withTYPE_LABEL
is appropriate.The changes improve the granularity of metrics tracking by including the index type as a label.
src/mito2/src/sst/index.rs (4)
41-43
: Addition ofTYPE_INVERTED_INDEX
andTYPE_FULLTEXT_INDEX
constants is appropriate.The new constants are necessary for distinguishing between different index types.
98-100
: Addition oflast_mem_inverted_index
andlast_mem_fulltext_index
fields is appropriate.The new fields are necessary for tracking memory usage metrics for different index types.
108-123
: Updates to callflush_mem_metrics
inupdate
,finish
, andabort
methods are appropriate.The changes ensure that memory usage metrics are flushed after each operation, improving the accuracy of metrics tracking.
126-143
: Addition offlush_mem_metrics
method is appropriate.The method accurately calculates and updates memory usage metrics for both inverted and full-text indexes.
src/mito2/src/sst/index/inverted_index/creator.rs (1)
123-123
: LGTM! EnsureStatistics::new
is correctly implemented.The initialization of
Statistics
withTYPE_INVERTED_INDEX
looks good.However, verify that the
Statistics::new
method properly initializes all required fields.Verification successful
Verification Successful
The
Statistics::new
method correctly initializes all required fields, includingindex_type
,update_elapsed
,finish_elapsed
,cleanup_eplased
,row_count
, andbyte_count
.
index_type
is properly initialized withTYPE_INVERTED_INDEX
.- Other fields are initialized with default values.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the implementation of `Statistics::new` method # Test: Search for the `Statistics::new` method implementation. Expect: Proper initialization of all fields. rg --type rust -A 5 'impl Statistics {.*fn new'Length of output: 174
Script:
#!/bin/bash # Description: Verify the implementation of `Statistics::new` method # Test: Search for the `Statistics::new` method implementation. Expect: Proper initialization of all fields. rg --type rust -A 5 'impl Statistics \{.*fn new'Length of output: 50
Script:
#!/bin/bash # Description: Search for all methods within the `Statistics` implementation to locate the `new` method. # Test: Search for all methods in the `Statistics` implementation. Expect: Locate the `new` method. rg --type rust 'impl Statistics \{'Length of output: 93
Script:
#!/bin/bash # Description: Verify the implementation of `Statistics::new` method within the specific file # Test: Search for the `new` method implementation in `src/mito2/src/sst/index/statistics.rs` rg --type rust 'fn new' src/mito2/src/sst/index/statistics.rs -A 10Length of output: 696
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #4337 +/- ##
==========================================
- Coverage 85.18% 84.90% -0.29%
==========================================
Files 1060 1060
Lines 189069 189089 +20
==========================================
- Hits 161057 160542 -515
- Misses 28012 28547 +535 |
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.
LGTM
I hereby agree to the terms of the GreptimeDB CLA.
Refer to a related PR or issue link (optional)
What's changed and what's your intention?
AS STATED
Checklist
Summary by CodeRabbit
New Features
IntCounterVec
andIntGaugeVec
.Improvements
TYPE_INVERTED_INDEX
,TYPE_FULLTEXT_INDEX
).Indexer
struct.SstIndexCreator
to provide more detailed metrics.Bug Fixes
flush_mem_metrics
.