refactor: Move memory_usage into IngressHistoryStats - #11211
Open
alin-at-dfinity wants to merge 1 commit into
Open
refactor: Move memory_usage into IngressHistoryStats#11211alin-at-dfinity wants to merge 1 commit into
memory_usage into IngressHistoryStats#11211alin-at-dfinity wants to merge 1 commit into
Conversation
`IngressHistoryState::memory_usage` and `IngressHistoryState::state_counts` are always updated and validated in tandem. Move `memory_usage` into `IngressHistoryStats` and rename `state_counts` to `stats`, now that it's more generic than just counts by state.
|
✅ No security or compliance issues detected. Reviewed everything up to 4eb5854. Security Overview
Detected Code Changes
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors ingress history transient bookkeeping by consolidating memory usage tracking into IngressHistoryStats and renaming the internal “counts” concept into a more general stats aggregation, keeping related invariants updated together.
Changes:
- Move ingress history
memory_usagetracking intoIngressHistoryStatsand store it underIngressHistoryState.stats. - Refactor “counts-by-state” handling to flow through
stats, including a singlecompute_stats()recomputation used in debug assertions and decoding. - Update metrics emission and tests to use the refactored
state_counts()iteration and newstatslayout.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| rs/replicated_state/src/metrics.rs | Adjust metrics loop to iterate directly over ingress_history.state_counts() (now returns an iterator). |
| rs/replicated_state/src/metadata_state/tests.rs | Update tests to reference the refactored stats.memory_usage. |
| rs/replicated_state/src/metadata_state/proto.rs | Update debug validation and decoding to recompute/assign the unified stats. |
| rs/replicated_state/src/metadata_state.rs | Consolidate transient ingress history bookkeeping into stats, add compute_stats(), and update internal update paths. |
| rs/replicated_state/src/lib.rs | Stop re-exporting IngressHistoryStats after it becomes an internal implementation detail. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
IngressHistoryState::memory_usageandIngressHistoryState::state_countsare always updated and validated in tandem. Movememory_usageintoIngressHistoryStatsand renamestate_countstostats, now that it's more generic than just counts by state.