Add Core RPC section to admin Stats tab

Surface invite diagnostics (RPC health, per-peer state, queues,
recommendations) under Resource Usage via /api/stats core payload
and auto-refreshing renderCoreStats in the stats UI.
This commit is contained in:
Raven Scott
2026-05-28 11:24:41 -04:00
parent 51184d2446
commit 1d309aa82d
3 changed files with 288 additions and 0 deletions
@@ -304,6 +304,17 @@ async function handleStatsRoutes(req, res) {
// Collect Hyperdrive stats
const hyperdriveStats = collectHyperdriveStats();
stats.hyperdrive = hyperdriveStats;
if (typeof state.diagnoseInviteIssues === 'function') {
try {
stats.core = state.diagnoseInviteIssues();
} catch (err) {
logDebug('Admin', `Core RPC stats unavailable: ${err.message}`);
stats.core = { initializing: true, error: err.message };
}
} else {
stats.core = { initializing: true };
}
const responseTime = Date.now() - startTime;
trackRequestWithTiming('/api/stats', true, responseTime);