198_channel_monitor_v2_health_thresholds.sql 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. -- Configurable Channel Monitor V2 health scoring thresholds.
  2. -- Defaults are intentionally tolerant: small amounts of real traffic errors or
  3. -- zero cache rate should not immediately paint the user page as "abnormal".
  4. ALTER TABLE channel_monitor_v2_config
  5. ADD COLUMN IF NOT EXISTS health_thresholds JSONB NOT NULL DEFAULT '{
  6. "minimum_sample": 50,
  7. "warning_error_rate": 0.05,
  8. "critical_error_rate": 0.20,
  9. "target_ttft_ms": 3000,
  10. "warning_ttft_ms": 8000,
  11. "critical_ttft_ms": 20000,
  12. "warning_cache_rate": 0,
  13. "critical_cache_rate": 0,
  14. "error_weight": 0.60,
  15. "ttft_weight": 0.20,
  16. "cache_weight": 0.20
  17. }'::jsonb;
  18. UPDATE channel_monitor_v2_config
  19. SET health_thresholds = '{
  20. "minimum_sample": 50,
  21. "warning_error_rate": 0.05,
  22. "critical_error_rate": 0.20,
  23. "target_ttft_ms": 3000,
  24. "warning_ttft_ms": 8000,
  25. "critical_ttft_ms": 20000,
  26. "warning_cache_rate": 0,
  27. "critical_cache_rate": 0,
  28. "error_weight": 0.60,
  29. "ttft_weight": 0.20,
  30. "cache_weight": 0.20
  31. }'::jsonb || health_thresholds
  32. WHERE id = 1;