Files
egg 07ced80fb0 feat(admin-perf): full Vue SPA migration + slow-query/memory monitoring gaps
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>
2026-02-26 09:48:54 +08:00

1.7 KiB

MODIFIED Requirements

Requirement: Connection pool status in performance detail

The performance-detail API SHALL include db_pool section with status (checked_out, checked_in, overflow, max_capacity, saturation, slow_query_active, slow_query_waiting) from get_pool_status() and config (pool_size, max_overflow, pool_timeout, pool_recycle) from get_pool_runtime_config().

Scenario: Pool status retrieved

  • WHEN the API is called
  • THEN db_pool.status SHALL contain current pool utilization metrics including slow_query_active and slow_query_waiting, and db_pool.config SHALL contain the pool configuration values

Scenario: Saturation calculation

  • WHEN the pool has 8 checked_out connections and max_capacity is 30
  • THEN saturation SHALL be reported as approximately 26.7%

Scenario: Slow query waiting included

  • WHEN 2 threads are waiting for the slow query semaphore
  • THEN db_pool.status.slow_query_waiting SHALL be 2

ADDED Requirements

Requirement: Slow-path query latency included in QueryMetrics

The read_sql_df_slow() and read_sql_df_slow_iter() functions SHALL call record_query_latency() with the total elapsed time upon completion, ensuring P50/P95/P99 percentiles reflect queries from all paths (pooled and slow/direct).

Scenario: Slow query latency recorded

  • WHEN read_sql_df_slow() completes a query in 8.5 seconds
  • THEN record_query_latency(8.5) SHALL be called and the value SHALL appear in subsequent get_percentiles() results

Scenario: Slow iter latency recorded

  • WHEN read_sql_df_slow_iter() completes streaming in 45 seconds
  • THEN record_query_latency(45.0) SHALL be called in the finally block