Add slow_alert_consecutive setting to control slow alert sensitivity
Exposes the consecutive-slow-checks requirement as a configurable setting instead of hardcoding 3. Saved under key 'slow_alert_consecutive' in the DB, readable via SLOW_ALERT_CONSECUTIVE env var. UI appears in Settings → Monitoring alongside the existing Consecutive Failures Threshold field. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
dd85a79d55
commit
3a3d32ecac
3 files changed
+19
-2
No files matched your search
+3
-2
@@ -181,8 +181,9 @@ class Scheduler {
|
||||
if (result.response_time > effectiveThreshold) {
|
||||
const consecutive = (this.slowConsecutiveCount.get(resource.id) || 0) + 1;
|
||||
this.slowConsecutiveCount.set(resource.id, consecutive);
|
||||
// Require 3 consecutive slow checks before alerting (avoids single-spike false positives)
|
||||
if (consecutive >= 3) {
|
||||
const slowAlertConsecutiveSetting = db.prepare(`SELECT value FROM settings WHERE key = 'slow_alert_consecutive'`).get();
|
||||
const slowAlertConsecutive = parseInt(slowAlertConsecutiveSetting?.value) || 3;
|
||||
if (consecutive >= slowAlertConsecutive) {
|
||||
const lastSlowAlert = this.slowAlertCooldown.get(resource.id) || 0;
|
||||
if (now - lastSlowAlert > 60 * 60 * 1000) {
|
||||
this.slowAlertCooldown.set(resource.id, now);
|
||||
|
||||
Reference in new issue
Block a user