-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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: add estimate_pending_compaction_bytes metric to analyze fragmentation rate #1736
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -189,6 +189,22 @@ var collectRocksDBMetrics = map[string]MetricConfig{ | |
}, | ||
}, | ||
|
||
// pending compaction bytes | ||
"estimate_pending_compaction_bytes": { | ||
Parser: ®exParser{ | ||
name: "estimate_pending_compaction_bytes", | ||
reg: regexp.MustCompile(`(?P<data_type>\w+)_.*?estimate_pending_compaction_bytes:(?P<estimate_pending_compaction_bytes>\d+)`), | ||
Parser: &normalParser{}, | ||
}, | ||
MetricMeta: &MetaData{ | ||
Name: "estimate_pending_compaction_bytes", | ||
Help: "Estimated total number of bytes that compression needs to rewrite to bring all levels down below the target size. Has no effect on compression other than level-based compression.", | ||
Type: metricTypeGauge, | ||
Labels: []string{LabelNameAddr, LabelNameAlias, "data_type"}, | ||
ValueName: "estimate_pending_compaction_bytes", | ||
}, | ||
}, | ||
|
||
// snapshots | ||
"num_snapshots": { | ||
Parser: ®exParser{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The code patch you provided adds a new metric configuration for "estimate_pending_compaction_bytes" to the existing
Overall, from the given code patch, there don't appear to be any obvious bugs or risks. However, it's essential to thoroughly test the code to ensure proper functionality. Additionally, it's challenging to provide further improvement suggestions without more context about the codebase and its requirements. |
||
|
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.
Based on the code patch provided, here are some observations and suggestions:
Observations:
GetRocksDBInfo
.Suggestions:
Confirm Dependency: Ensure that you have verified that the
rocksdb::DB::Properties::kEstimatePendingCompactionBytes
property is available and works as expected in your version of RocksDB.Error Handling: It's important to handle any potential errors that may occur during the process of retrieving and writing the properties. Make sure appropriate error handling mechanisms (e.g., try-catch) are implemented.
Code Documentation: Consider adding comments to describe the purpose of this function and the significance of each property being written to the info stream.
Review Other Properties: Since this code patch only includes the addition of the "estimate_pending_compaction_bytes" property, it's worth considering if there are any other relevant properties that should be included in the info stream.
Unit Testing: Test the functionality of this code patch thoroughly to ensure it produces the desired results and doesn't introduce any unexpected issues. Verify that the info stream contains all the expected properties and their corresponding values.
Remember that without additional context and a complete understanding of your codebase and requirements, it's difficult to provide a comprehensive review.