Skip to content

Commit cbb3b0a

Browse files
authored
Handle the first occurence of an error as urgent (#28)
1 parent c6e9e72 commit cbb3b0a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/sysmonitor/SystemMonitor.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,10 @@ private function rateAndStore(SystemEvent $sysEvt)
101101
$count = $this->storage->count($sysEvt);
102102

103103
// uplift severity..
104-
if ($count >= 10 && $evt instanceof RequestExceptionEvent) {
104+
if ($count === 0 && $evt instanceof RequestExceptionEvent) {
105+
// report the first occurence immediately, but don't report every single error
106+
$sysEvt->severity = SystemEvent::SEVERITY_URGENT;
107+
} elseif ($count >= 10 && $evt instanceof RequestExceptionEvent) {
105108
// .. based on frequency of the same failure
106109
$sysEvt->severity = SystemEvent::SEVERITY_URGENT;
107110
} elseif ($count >= 20 && $evt instanceof RequestStatsEvent) {

0 commit comments

Comments
 (0)