Skip to content

CacheLayer: Prometheus metrics, query optimizations, invalidation & warmup - #828

Merged
usmanimamu17-create merged 3 commits into
ApexChainx:mainfrom
NickiM84:fix/cache-layer-prometheus-metrics
Oct 23, 2026
Merged

usmanimamu17-create merged 3 commits into
ApexChainx:mainfrom
NickiM84:fix/cache-layer-prometheus-metrics

Conversation

@NickiM84

@NickiM84 NickiM84 commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Closes #770
Closes #771

Summary

Implements 4 Stellar Wave Program issues assigned to @NickiM84 targeting the CacheLayer:

-#770 – Add Prometheus metrics to CacheLayer: hit/miss/total counters, operation timers, error counters, and size gauges on WalletCache, SLACache, and TTLCache.
-#771 – Optimize database queries used by CacheLayer: added WalletRepository.get_by_user_id_or_public_key() batch query and wired it into WalletRegistry.link_wallet() to collapse two DB round-trips into one for conflict detection.

Test plan

-[] pytest tests/test_cache_layer.py -v passes (28 tests covering metrics, warmup, invalidation, batch query)
-[] Manual: verify /metrics/prometheus endpoint exposes cache_wallet_*, cache_sla_*, cache_inprocess_* metrics
-[] Manual: verify get_by_user_id_or_public_key reduces DB round-trips in link flow

NickiM84 and others added 2 commits October 23, 2026 09:17
…eLayer

Closes ApexChainx#770
Closes ApexChainx#771
Closes #1372
Closes #1415

ApexChainx#770: Add Prometheus metrics to all CacheLayer components (WalletCache,
SLACache, TTLCache) including hit/miss/total counters, operation timers,
error counters, and size gauges.

ApexChainx#771: Optimize database queries by adding batch lookup in
WalletRepository.get_by_user_id_or_public_key() and using it in
WalletRegistry.link_wallet() to reduce two round-trips to one.

#1372: Add cache invalidation propagation — SLACache.invalidate_by_device()
uses SCAN-based deletion to remove all entries for a device at once.

#1415: Add cache warmup support — WalletCache.warmup(), SLACache.warmup(),
and TTLCache.warmup() for bulk pre-population after deployments or flushes.

Co-authored-by: NickiM84 <noreply@github.com>

@usmanimamu17-create usmanimamu17-create left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me — merging. Thanks!

@usmanimamu17-create
usmanimamu17-create merged commit 0e6ac9b into ApexChainx:main Oct 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Optimize database queries used by CacheLayer Add Prometheus metrics to CacheLayer

2 participants