Paradaux
IssuesPAR-135Done
0

/admin/api-keys: parallelize + cache the Prometheus usage queries

/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:

  1. Run the two Prom queries in parallel (Promise.all) — worst case 6s → 3s.
  2. 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.
  3. 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.)

Comments

No comments yet.

Activity

  • ParadauxIO linked a commit — Commit 3154eab — Merge pull request #11 from MCCitiesNetwork/developJun 7, 2026, 9:15 PM
  • ParadauxIO linked a commit — Commit 3a25bb1 — /admin/api-keys: parallelize + cache Prometheus usage queries (PAR-135)Jun 7, 2026, 9:15 PM
  • ParadauxIO changed status to Status → DoneJun 7, 2026, 9:15 PM
  • ParadauxIO linked a pull request — PR #11 merged — Release economy-explorer → main (api-keys Prometheus fix, PAR-135)Jun 7, 2026, 9:15 PM
  • tesks changed status to Status → Pending ReleaseJun 7, 2026, 9:00 PM
  • ParadauxIO linked a pull request — PR #11 open — Release economy-explorer → main (api-keys Prometheus fix, PAR-135)Jun 7, 2026, 9:00 PM
  • ParadauxIO linked a commit — Commit 3a25bb1 — /admin/api-keys: parallelize + cache Prometheus usage queries (PAR-135)Jun 7, 2026, 8:59 PM
  • tesks created the issueJun 7, 2026, 8:58 PM