Repository navigation
fix(metrics): repair shadow-cache comparison and export Prometheus data - #19
Merged
Merged
Conversation
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.
A primary hit with a shadow miss never populated the shadow cache; primary misses also replaced existing shadow hits. This biased the advertised same-traffic policy comparison. Populate shadow misses from primary hits and inspect shadow entries without counting another request or changing eviction state before insertion.
Export real Prometheus cache counters and size/capacity gauges with policy and role labels. Calculate throughput from elapsed time, reset baselines when cache instances change, and preserve monotonic exported counters. Document that throughput counts cache lookups and remove claims for unimplemented latency histograms.
PR #7 (cache capacity/safety) has already been merged into the branch for #14. This PR retains cache-capacity-safety as its base. Its diff contains only comparison and observability changes.
Validation: 62 Rust tests (including prerequisites), with five comparison/metrics regressions; cargo fmt; strict Clippy across all targets. Tests cover both directions of cache divergence, bench-mode isolation, elapsed-time throughput, and rendered Prometheus output. The combined runtime smoke check verified the live metrics endpoint.
Replaces #13 after removing the codex/ branch prefix. Commit contents are preserved; the original PR retains prior discussion and review history.