perf(metrics): expose pre-warm cache hit / RPC-fetch counters - #179
Merged
Conversation
Caches landed in #173/#174/#178 had no Prometheus instrumentation; only a debug log line reported cycle outcomes. Adds five IntCounters so the shadow-mode dashboard can read RPC-reduction ratios directly. - aether_prewarm_bytecode_cache_hits_total - aether_prewarm_bytecode_rpc_fetches_total - aether_prewarm_v2_reserves_cache_hits_total - aether_prewarm_v2_reserves_cache_stale_total - aether_prewarm_v2_reserves_cache_missing_total Implementation surfaces a PrewarmStats struct from prewarm_state and splits V2ReservesCache::get_fresh into a V2CacheLookup enum so the stale vs missing distinction reaches the counter without changing the fast path. Engine and mempool refresher both call record_prewarm_stats after every cycle.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
6 tasks
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.
Summary
The cache stack landed without Prometheus instrumentation — only a
debug!log line per cycle. Adds five counters so shadow-mode dashboards can read RPC-reduction ratios directly instead of grepping logs.aether_prewarm_bytecode_cache_hits_totalaether_prewarm_bytecode_rpc_fetches_totalaether_prewarm_v2_reserves_cache_hits_totalaether_prewarm_v2_reserves_cache_stale_totalaether_prewarm_v2_reserves_cache_missing_totalThe headline panel is
rate(cache_hits) / (rate(cache_hits) + rate(rpc_fetches))— monotonic upward as cache warms.Files Changed
crates/simulator/src/fork.rsPrewarmedStatenow carries a publicPrewarmStatsfield; partition loop counts stale vs missing instead of bucketing both into None.crates/simulator/src/v2_reserves_cache.rsV2CacheLookupenum +get_fresh_status.get_freshis now a thin wrapper so existing callers stay source-compatible.crates/grpc-server/src/metrics.rsrecord_prewarm_stats(PrewarmStats)+ 5*_count()getters for tests.crates/grpc-server/src/engine.rscrates/grpc-server/src/mempool_pipeline.rsNo behavioural change: the
get_fresh_statusenum is internal to the cache module; oldget_freshreturns the sameOption<ReserveSnapshot>as before.Acceptance Criteria
Registry.Engine+ mempool refresher) callrecord_prewarm_statsexactly once per cycle.get_freshexternal behaviour unchanged;get_fresh_statuslights the new code path.cargo clippy --all-targets -- -D warningsclean on touched crates.cargo test --workspace --lib— 510 passed (was 510, +1 new test in metrics + 1 new in v2_reserves_cache).cargo build --workspace --release— green.go test ./...— green.Test plan
record_prewarm_stats_bumps_all_five_counters— applies two syntheticPrewarmStats, asserts the counters accumulate, verifies the/metricstext output shows the right totals.get_fresh_status_distinguishes_stale_from_missing— separate addresses for unseen / cached-stale / cached-fresh; matches the three enum variants.aether_prewarm_bytecode_cache_hits_totalclimbs across consecutive blocks andaether_prewarm_bytecode_rpc_fetches_totalplateaus once the cache is warm.