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

[rocksdb] add metric for num level 0 files #19230

Merged
merged 2 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions crates/typed-store/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ pub struct ColumnFamilyMetrics {
pub rocksdb_total_sst_files_size: IntGaugeVec,
pub rocksdb_total_blob_files_size: IntGaugeVec,
pub rocksdb_total_num_files: IntGaugeVec,
pub rocksdb_num_level0_files: IntGaugeVec,
pub rocksdb_current_size_active_mem_tables: IntGaugeVec,
pub rocksdb_size_all_mem_tables: IntGaugeVec,
pub rocksdb_num_snapshots: IntGaugeVec,
Expand Down Expand Up @@ -124,6 +125,13 @@ impl ColumnFamilyMetrics {
registry,
)
.unwrap(),
rocksdb_num_level0_files: register_int_gauge_vec_with_registry!(
"rocksdb_num_level0_files",
"Number of level 0 files in the column family",
&["cf_name"],
registry,
)
.unwrap(),
rocksdb_current_size_active_mem_tables: register_int_gauge_vec_with_registry!(
"rocksdb_current_size_active_mem_tables",
"The current approximate size of active memtable (bytes).",
Expand Down
8 changes: 8 additions & 0 deletions crates/typed-store/src/rocks/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1006,6 +1006,14 @@ impl<K, V> DBMap<K, V> {
.rocksdb_total_num_files
.with_label_values(&[cf_name])
.set(total_num_files);
db_metrics
.cf_metrics
.rocksdb_num_level0_files
.with_label_values(&[cf_name])
.set(
Self::get_int_property(rocksdb, &cf, &num_files_at_level(0))
.unwrap_or(METRICS_ERROR),
);
db_metrics
.cf_metrics
.rocksdb_current_size_active_mem_tables
Expand Down
2 changes: 2 additions & 0 deletions deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ ignore = [
"RUSTSEC-2024-0336",
# allow yaml-rust being unmaintained
"RUSTSEC-2024-0320",
# allow unmaintained proc-macro-error used in transitive dependencies
"RUSTSEC-2024-0370",
]
# Threshold for security vulnerabilities, any vulnerability with a CVSS score
# lower than the range specified will be ignored. Note that ignored advisories
Expand Down
Loading