Skip to content

feat(latency): fetch real latency series via latencyApi and remove fa… - #1487

Open
digofavour-hub wants to merge 1 commit into
CalloraOrg:mainfrom
digofavour-hub:feat/latency-chart-api
Open

digofavour-hub wants to merge 1 commit into
CalloraOrg:mainfrom
digofavour-hub:feat/latency-chart-api

Conversation

@digofavour-hub

Copy link
Copy Markdown

Closes #1411

Summary

  • Added src/api/latencyApi.ts exporting fetchLatencySeries({ apiId, range, signal }) routed through authFetch (with the endpoint path isolated in buildLatencyPath), strict response/point validation into LatencyPoint[], error mapping (401/HTTP/network/invalid JSON/abort), and demo-mode sample data fallback when API_BASE is empty.
  • Rewrote useLatencyData in src/pages/LatencyChart.tsx to call fetchLatencySeries with an AbortController, preserving the generation guard, isStale, and retry behaviour while removing LOADING_DELAY_MS and all setTimeout fake loading.
  • Read ?api=<id> from URL search params in LatencyChart with a clear "No API Selected" empty state when a backend is configured and no API is selected.
  • Surfaced server-provided p95 when present in the response, falling back to computeStats.
  • Labelled demo fallback data with a Sample data badge when API_BASE is empty.
  • Updated docs/Deployment.md fixture matrix with the Latency chart row.

Testing

  • Added src/api/latencyApi.test.ts (13 tests) covering point/response validation, malformed points, non-numeric values, empty series, 401/500/network/invalid JSON/abort handling, and demo mode detection.
  • Updated src/pages/LatencyChart.test.tsx (15 tests) removing the ../config/constants mock and mocking ../api/latencyApi, covering ?api= query param reading, empty state, demo mode badge, server p95, single-point series, stale state, retry, unmount abort, and out-of-order race-condition guard.
  • Ran npm test -- --run src/pages/LatencyChart.test.tsx src/api/latencyApi.test.ts src/utils/downsample.test.ts (30/30 passing).

@drips-wave

drips-wave Bot commented Nov 23, 2026

Copy link
Copy Markdown

@digofavour-hub 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

Development

Successfully merging this pull request may close these issues.

Drive LatencyChart from a real per-API latency series and drop the LOADING_DELAY_MS timer

1 participant