Fix split cache metrics#76
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adjusts how split-cache Prometheus metrics are recorded so eviction metrics better reflect actual committed evictions (addressing inflated eviction rates compared to downloads).
Changes:
- Centralizes “split added to disk” and “split evicted” metric updates into helper functions.
- Records eviction metrics only after eviction is confirmed (no rollback), rather than during intermediate removal/reinsert flows.
- Adds metric recording when acknowledging pre-existing on-disk splits and when registering a split as downloaded.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
rdettai-sk
commented
Jul 3, 2026
Comment on lines
-155
to
-170
| crate::metrics::STORAGE_METRICS | ||
| .searcher_split_cache | ||
| .in_cache_count | ||
| .dec(); | ||
| crate::metrics::STORAGE_METRICS | ||
| .searcher_split_cache | ||
| .in_cache_num_bytes | ||
| .sub(num_bytes as i64); | ||
| crate::metrics::STORAGE_METRICS | ||
| .searcher_split_cache | ||
| .evict_num_items | ||
| .inc(); | ||
| crate::metrics::STORAGE_METRICS | ||
| .searcher_split_cache | ||
| .evict_num_bytes | ||
| .inc_by(num_bytes); |
Collaborator
Author
There was a problem hiding this comment.
the issue here was that remove is called for mutations that don't necessarily imply an eviction (the split is usually added back before releasing the lock
Darkheir
approved these changes
Jul 3, 2026
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.
Description
We have search split cache evictions at 1000x the download rate. I always found that a bit weird :-)
How was this PR tested?
Describe how you tested this PR.