Remove Jinja2 template fallback (1249 lines) — /admin/performance now serves Vue SPA exclusively via send_from_directory. Backend: - Add _SLOW_QUERY_WAITING counter with get_slow_query_waiting_count() - Record slow-path latency in read_sql_df_slow/iter via record_query_latency() - Extend metrics_history schema with slow_query_active, slow_query_waiting, worker_rss_bytes columns + ALTER TABLE migration for existing DBs - Add cleanup_archive_logs() with configurable ARCHIVE_LOG_DIR/KEEP_COUNT - Integrate archive cleanup into MetricsHistoryCollector 50-min cycle Frontend: - Add slow_query_active and slow_query_waiting StatCards to connection pool - Add slow_query_active trend line to pool trend chart - Add Worker memory (RSS MB) trend chart with preprocessing - Update modernization gate check path to frontend style.css Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1.2 KiB
1.2 KiB
ADDED Requirements
Requirement: Worker RSS memory in metrics history snapshots
The MetricsHistoryCollector SHALL include worker_rss_bytes in each 30-second snapshot, recording the current worker process peak RSS memory using Python's resource.getrusage().
Scenario: RSS recorded in snapshot
- WHEN the collector writes a snapshot and the worker process has 256 MB peak RSS
- THEN the
worker_rss_bytescolumn SHALL contain approximately 268435456
Scenario: RSS collection failure
- WHEN
resource.getrusage()raises an exception - THEN the collector SHALL write NULL for
worker_rss_bytesand continue collecting other metrics
Requirement: Worker memory trend chart in Vue SPA
The admin performance Vue SPA SHALL display a "Worker 記憶體趨勢" TrendChart showing RSS memory over time in megabytes.
Scenario: Memory trend displayed
- WHEN historical snapshots contain
worker_rss_bytesdata with more than 1 data point - THEN the dashboard SHALL display a TrendChart with RSS values converted to MB
Scenario: No memory data
- WHEN historical snapshots do not contain
worker_rss_bytesdata (all NULL) - THEN the trend chart SHALL show "趨勢資料不足" message