feat(metrics): export per-level SST file counts to Prometheus#189
feat(metrics): export per-level SST file counts to Prometheus#189philippem wants to merge 1 commit intoBlockstream:new-indexfrom
Conversation
|
lgtm |
shesek
left a comment
There was a problem hiding this comment.
Looks good, two minor nits but I'd also be fine with it as-is.
src/new_index/db.rs
Outdated
| let prop = format!("rocksdb.num-files-at-level{}", level); | ||
| let level_str = level.to_string(); | ||
| if let Ok(Some(value)) = db_arc_levels.property_value(&prop) { | ||
| if let Ok(v) = value.parse::<f64>() { |
There was a problem hiding this comment.
This matches the existing update_gauge() behavior, but its kind of strange that invalid values are silently discarded. Maybe log a warnings if parse::<f64> fails?
src/new_index/db.rs
Outdated
| for level in 0..7u32 { | ||
| let prop = format!("rocksdb.num-files-at-level{}", level); | ||
| let level_str = level.to_string(); | ||
| if let Ok(Some(value)) = db_arc_levels.property_value(&prop) { |
There was a problem hiding this comment.
Maybe handle the per-level gauges through update_gauge() too? It can take an additional_labels: &[&str] argument and concat() it with the default db name label.
This would reduce some duplication and make the extra db_arc_levels/label_levels clones unnecessary.
There was a problem hiding this comment.
please check again. claude made these changes, so may not be reasonable.
src/new_index/db.rs
Outdated
| update_gauge(&db_metrics.block_cache_capacity, "rocksdb.block-cache-capacity"); | ||
| update_gauge(&db_metrics.block_cache_usage, "rocksdb.block-cache-usage"); | ||
| update_gauge(&db_metrics.block_cache_pinned_usage, "rocksdb.block-cache-pinned-usage"); | ||
| for level in 0..7u32 { |
There was a problem hiding this comment.
This could use a ROCKSDB_NUM_LEVELS const (with ..=)
Adds rocksdb_num_files_at_level{db, level} gauge, polled every 5s
via the existing stats exporter loop. Covers levels 0-6 (RocksDB default).
Useful for monitoring L0 file accumulation during initial sync.
9724742 to
14eefe8
Compare
Adds rocksdb_num_files_at_level{db, level} gauge, polled every 5s via the existing stats exporter loop. Covers levels 0-6 (RocksDB default). Useful for monitoring L0 file accumulation during initial sync.