feat(metrics): export per-level SST file counts to Prometheus#189
Open
philippem wants to merge 1 commit intoBlockstream:new-indexfrom
Open
feat(metrics): export per-level SST file counts to Prometheus#189philippem wants to merge 1 commit intoBlockstream:new-indexfrom
philippem wants to merge 1 commit intoBlockstream:new-indexfrom
Conversation
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.
|
lgtm |
Randy808
approved these changes
Mar 4, 2026
shesek
approved these changes
Mar 5, 2026
Collaborator
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.
| 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>() { |
Collaborator
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?
| 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) { |
Collaborator
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.
shesek
reviewed
Mar 5, 2026
| 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 { |
Collaborator
There was a problem hiding this comment.
This could use a ROCKSDB_NUM_LEVELS const (with ..=)
This file contains hidden or 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
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.
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.