Files
sub2api/backend/migrations/198_channel_monitor_v2_health_thresholds.sql
T
IanShaw027 a58048ac32 feat(channel-monitor-v2): 添加被动监控聚合表与模式相关迁移
引入 V2 事实表/固定 rollup、模式设置、忽略错误类、健康阈值、权限与
默认忽略/缓存阈值,以及用户端隐藏吞吐速率的系统设置键。
2026-08-07 11:05:32 +08:00

34 lines
1.1 KiB
SQL

-- Configurable Channel Monitor V2 health scoring thresholds.
-- Defaults are intentionally tolerant: small amounts of real traffic errors or
-- zero cache rate should not immediately paint the user page as "abnormal".
ALTER TABLE channel_monitor_v2_config
ADD COLUMN IF NOT EXISTS health_thresholds JSONB NOT NULL DEFAULT '{
"minimum_sample": 50,
"warning_error_rate": 0.05,
"critical_error_rate": 0.20,
"target_ttft_ms": 3000,
"warning_ttft_ms": 8000,
"critical_ttft_ms": 20000,
"warning_cache_rate": 0,
"critical_cache_rate": 0,
"error_weight": 0.60,
"ttft_weight": 0.20,
"cache_weight": 0.20
}'::jsonb;
UPDATE channel_monitor_v2_config
SET health_thresholds = '{
"minimum_sample": 50,
"warning_error_rate": 0.05,
"critical_error_rate": 0.20,
"target_ttft_ms": 3000,
"warning_ttft_ms": 8000,
"critical_ttft_ms": 20000,
"warning_cache_rate": 0,
"critical_cache_rate": 0,
"error_weight": 0.60,
"ttft_weight": 0.20,
"cache_weight": 0.20
}'::jsonb || health_thresholds
WHERE id = 1;