PAR-135
0
/admin/api-keys: parallelize + cache the Prometheus usage queries
DoneNormalUnassignedEconomy Explorer
/admin/api-keys is usually ~260ms (Faro), but queryKeyUsage() (lib/prometheus.ts) is uncached (cache: 'no-store') and fires its two PromQL queries sequentially, each with a 3s timeout — so when Prometheus is loaded/restarting the page blocks up to 6s before failing soft. Spiky, so it doesn't show in the few admin Faro samples.
Fixes:
- Run the two Prom queries in parallel (
Promise.all) — worst case 6s → 3s. - Cache the usage result ~30s via
unstable_cache(return serializable entries, rebuild the Map in the page — a raw Map doesn't survive the data cache) — takes the Prom round-trips off the hot path; a slow Prometheus no longer blocks every load. - Tighten the per-query timeout 3s → 1.5s so a slow Prometheus degrades faster.
(Perceived-nav snappiness for this page was already handled by PAR-133's root loading.tsx + admin nav prefetch.)
Resources
- commit3154eab Merge pull request #11 from MCCitiesNetwork/developMCCitiesNetwork/economy-explorer
- commit3a25bb1 /admin/api-keys: parallelize + cache Prometheus usage queries (PAR-135)MCCitiesNetwork/economy-explorer
- PR · merged#11 Release economy-explorer → main (api-keys Prometheus fix, PAR-135)MCCitiesNetwork/economy-explorer
Comments
No comments yet.
Activity
- ParadauxIO linked a commit — Commit 3154eab — Merge pull request #11 from MCCitiesNetwork/develop
- ParadauxIO linked a commit — Commit 3a25bb1 — /admin/api-keys: parallelize + cache Prometheus usage queries (PAR-135)
- ParadauxIO changed status to Status → Done
- ParadauxIO linked a pull request — PR #11 merged — Release economy-explorer → main (api-keys Prometheus fix, PAR-135)
- tesks changed status to Status → Pending Release
- ParadauxIO linked a pull request — PR #11 open — Release economy-explorer → main (api-keys Prometheus fix, PAR-135)
- ParadauxIO linked a commit — Commit 3a25bb1 — /admin/api-keys: parallelize + cache Prometheus usage queries (PAR-135)
- tesks created the issue