Capacity planning#97
Merged
elizabetheonoja-art merged 2 commits intoJul 18, 2026
Merged
Conversation
Add capacity planning forecast dashboard
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Provide a deterministic, client-side capacity planning forecast based on historical hourly usage to help capacity planning and alerting for the usage dashboard (issue #89).
Expose a clear risk classification and recommended capacity so operators can route expansion and incident response through existing blue-green/canary processes.
Keep the runtime path fast and testable by implementing a pure buildCapacityPlan function and wiring it into the live dashboard example.
Description
Add a capacity planning computation in usage-dashboard/src/lib/capacityPlanning.ts that normalizes usage into daily kWh, derives a growth trend, applies safety/reserve margins, projects a configurable 30-day window, and assigns low|medium|high|critical risk levels.
Add a UI panel usage-dashboard/src/components/CapacityPlanningPanel.tsx that displays utilization, growth rate, breach forecast, recommended capacity, and a compact progress visualization.
Wire the plan into the dashboard by updating usage-dashboard/src/app/page.tsx and extend the TypeScript types in usage-dashboard/src/types/index.ts with CapacityPlan and related interfaces.
Add runbook documentation docs/CAPACITY_PLANNING_RUNBOOK.md describing architecture, alert policy, monitoring, and blue-green/canary rollout guidance, and remove the external Google font import and obsolete Next config in usage-dashboard/src/app/layout.tsx and usage-dashboard/next.config.js so production builds are deterministic.
Testing
Ran TypeScript checks with cd usage-dashboard && npx tsc --noEmit, which completed successfully.
Ran the production build with cd usage-dashboard && npm run build, which initially failed due to fetching the external Google font but succeeded after removing the external font import and updating next.config.js.
After fixes, re-ran cd usage-dashboard && npm run build and the build completed successfully (pages compiled and static routes generated).
Closes #89