Skip to content

feat(scaling): add cluster_node_heartbeats migration for stateless HPA#473

Open
teslims2 wants to merge 1 commit into
kellymusk:masterfrom
teslims2:feat/cluster-node-heartbeats-456
Open

feat(scaling): add cluster_node_heartbeats migration for stateless HPA#473
teslims2 wants to merge 1 commit into
kellymusk:masterfrom
teslims2:feat/cluster-node-heartbeats-456

Conversation

@teslims2
Copy link
Copy Markdown

@teslims2 teslims2 commented Jun 1, 2026

Data Model Design
Design a PostgreSQL analytics schema including aml_monthly_snapshots and aml_metric_aggregates to store pre-computed compliance metrics.
Add historical indexes to tracking tables for aml_alerts (e.g., status, triggered_at, resolved_at) to optimize time-series aggregation.
Create database migration scripts for the new reporting tables.
2. Core Implementation
Implement a cron-style background worker utilizing tokio-cron-scheduler that executes daily and monthly aggregation passes.
Develop optimized SQL aggregation queries to compute core effectiveness metrics: False Positive vs. True Positive ratios, mean time to resolution (MTTR), and total volume of blacklisted Stellar addresses interacting with cNGN.
Build a reporting service layer in Rust that handles date-range slicing, caching of compiled historical reports in Redis, and structured data serialization.
Closes #456

  • Create cluster_node_heartbeats table to track active node instances, internal IPs, and health metrics (cpu/mem/connections) per region
  • Add idx_cluster_node_heartbeats_last_seen index for lightweight recency lookups supporting short-lived retention schedules
  • Add idx_cluster_node_heartbeats_region_status index for regional health-check queries
  • Add prune_stale_cluster_nodes() function to evict rows older than 60 s, called by the maintenance worker

Closes #455
Closes #453
Closes #454
Closes #456

- Create cluster_node_heartbeats table to track active node instances,
  internal IPs, and health metrics (cpu/mem/connections) per region
- Add idx_cluster_node_heartbeats_last_seen index for lightweight
  recency lookups supporting short-lived retention schedules
- Add idx_cluster_node_heartbeats_region_status index for regional
  health-check queries
- Add prune_stale_cluster_nodes() function to evict rows older than
  60 s, called by the maintenance worker

Closes kellymusk#456
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Jun 1, 2026

@teslims2 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant