feat(metrics): rate-limit snapshot cache metrics on shared hosts#108
Merged
khaile merged 3 commits intoJul 3, 2026
Conversation
…-112) Add rate-limiting infrastructure to snapshot cache metrics (capsule_snapshot_cache_hits, capsule_snapshot_cache_misses, capsule_snapshot_eviction_count, capsule_snapshot_eviction_bytes) when the host is configured for shared multi-tenancy. Changes: - Add set_metric_redaction/is_metric_redaction_enabled to capsule-core - Add rate-limited record_snapshot_cache_hit/miss/eviction functions using parking_lot::Mutex (no poisoning, faster fast path) - Wire up metric emission in TieredCacheManager::lookup and evict - Connect host-agent shared_host_metric_redaction flag to capsule-core - Document host-level aggregation limitation (tenant context not yet available in the cache tiering layer) On dedicated-tenancy hosts, full per-host granularity is maintained. On shared hosts, metrics are rate-limited to 60s intervals per key. Closes CAP-112
c605a99 to
0c49f4b
Compare
Update AGENTS.md with guidelines for hashbrown and parking_lot.
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
Implements SC-IMPL-04 (CAP-112): Rate-limit snapshot cache metrics on shared hosts.
Changes
set_metric_redaction/is_metric_redaction_enabledtocapsule-coremetrics modulerecord_snapshot_cache_hit,record_snapshot_cache_miss,record_snapshot_evictionfunctionsTieredCacheManager::lookup()(hits/misses) andCacheTierStore::evict()(evictions)shared_host_metric_redactionflag to capsule-core metricsBehavior
tenant_idlabel when availableMetrics affected
capsule_snapshot_cache_hitscapsule_snapshot_cache_missescapsule_snapshot_eviction_countcapsule_snapshot_eviction_bytesTesting
cargo clippy --all-targets --all-features --locked -- -D warningspassesCloses CAP-112