Files
sub2api/backend/migrations/198_channel_monitor_v2_health_thresholds.sql
T
李建琦 6d655c9903
Release / update-version (push) Has been cancelled
Release / build-frontend (push) Has been cancelled
Release / release (push) Has been cancelled
Release / sync-version-file (push) Has been cancelled
CI / shell (push) Canceled after 0s
CI / test (push) Canceled after 0s
CI / frontend (push) Canceled after 0s
CI / golangci-lint (push) Canceled after 0s
Security Scan / backend-security (push) Canceled after 0s
Security Scan / frontend-security (push) Canceled after 0s
Sub2API v1.0 - AI API 网关(二开初始版本,基于上游 Wei-Shaw/sub2api)
2026-08-21 18:30:13 +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;