feat: Implement Phase 2 wipe performance analytics dashboard

Complete implementation of wipe analytics system providing operational
insights and data-driven wipe timing optimization.

Backend:
- Added comprehensive analytics query layer to db/wipes.rs:
  - Success rate calculation over time ranges
  - Average wipe duration tracking
  - Post-wipe population curve analysis (Day 1/2/3)
  - Optimal wipe timing recommendations based on player peaks
  - Individual wipe entry tracking with peak population correlation
- Implemented GET /api/analytics/wipes/performance endpoint with
  flexible range parameters (6d/12d/90d/all)
- All queries leverage hourly aggregate tables for 90-day retention

Frontend:
- Built WipeAnalyticsView.vue with 3 ECharts visualizations:
  - Success rate timeline (scatter: green success, red failures)
  - Population curve comparing Day 1/2/3 post-wipe averages
  - Wipe duration trend showing execution time evolution
- Insight cards displaying success rate, avg duration, peak day, optimal timing
- Actionable recommendations banner with data-driven suggestions:
  - Optimal wipe scheduling based on historical player peaks
  - Wipe frequency recommendations (weekly vs bi-weekly)
  - Duration optimization alerts
  - Rollback protection warnings
- Time range selector and CSV export functionality
- Added /wipes/analytics route

TypeScript interfaces added: WipePerformanceMetrics, WipeAnalyticsEntry,
PopulationCurve

Answers critical operational questions: "How long do wipes take? When do
players peak post-wipe? What's my success rate? When should I wipe for
maximum population?"

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Vantz Stockwell
2026-02-15 14:25:19 -05:00
parent dfa605f44f
commit 8790072609
3 changed files with 776 additions and 2 deletions

View File

@@ -4,6 +4,45 @@ All notable changes to this project will be documented in this file.
## [Unreleased]
### Added (Phase 2 — Wipe Performance Analytics)
**Backend:**
- `backend/src/db/wipes.rs` — Comprehensive wipe analytics query layer:
- `get_wipe_success_rate()` — Success vs failure rate over time range
- `get_average_wipe_duration()` — Average execution time for successful wipes
- `get_wipe_to_peak_population()` — Hours from wipe completion to peak player count (24h window)
- `get_population_curve_by_cycle()` — Day 1 vs Day 2 vs Day 3 average player counts post-wipe
- `get_optimal_wipe_timing()` — Recommends best day of week + hour based on historical peak populations
- `get_wipe_analytics_entries()` — Detailed per-wipe records for charting (duration, peak pop, success)
- All queries use hourly aggregates (`server_stats_hourly`) with 90-day retention
- `backend/src/api/analytics.rs` — Wipe performance endpoint:
- `GET /api/analytics/wipes/performance?range=90d` — Returns full wipe performance metrics
- Supports range params: `6d`, `12d`, `90d`, `all` (converted to wipe count estimates)
- Response includes: success rate, avg duration, population curve, optimal timing, individual wipe entries
**Frontend:**
- `WipeAnalyticsView.vue` — Complete wipe performance dashboard:
- **ECharts Visualizations:**
- Wipe success timeline (scatter plot: green = success, red = failed)
- Population curve bar chart (Day 1/Day 2/Day 3 average players post-wipe)
- Wipe duration trend (line chart showing execution time evolution)
- **Insight Cards:**
- Success rate percentage with total wipe count
- Average wipe duration (formatted as minutes:seconds)
- Peak population day identifier
- Optimal wipe timing recommendation (day + hour)
- **Actionable Recommendations Banner:**
- Optimal wipe day/hour based on post-wipe player peaks
- Weekly vs bi-weekly wipe suggestion (if Day 1 >> Day 2 population)
- Duration optimization alerts (if avg > 10 minutes)
- Rollback protection warnings (if failures detected)
- Time range selector: Last 6 wipes / Last 12 wipes / All time
- CSV export functionality
- Added route `/wipes/analytics` to router
- TypeScript interfaces: `WipePerformanceMetrics`, `WipeAnalyticsEntry`, `PopulationCurve`
**Purpose:** Answers critical questions: "How long do wipes take? When do players peak post-wipe? What's my success rate? When should I schedule wipes for max population?" Enables data-driven wipe timing optimization and operational insights.
### Added (Phase 3 — Public Status Page)
**Backend:**