- Add DISCOVERY_LOG_LEVEL=debug - Add DISCOVERY_SHOW_PROGRESS=true - Temporary changes for debugging InitializerProcessor fixes on production
89 lines
2.3 KiB
PHP
89 lines
2.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Framework\ErrorAggregation;
|
|
|
|
/**
|
|
* Alert urgency levels for notification prioritization
|
|
*/
|
|
enum AlertUrgency: string
|
|
{
|
|
case URGENT = 'urgent'; // Immediate attention required (SMS, call)
|
|
case HIGH = 'high'; // High priority (push notification, email)
|
|
case MEDIUM = 'medium'; // Medium priority (email)
|
|
case LOW = 'low'; // Low priority (daily digest)
|
|
|
|
/**
|
|
* Gets timeout in seconds for escalation
|
|
*/
|
|
public function getEscalationTimeout(): int
|
|
{
|
|
return match ($this) {
|
|
self::URGENT => 300, // 5 minutes
|
|
self::HIGH => 900, // 15 minutes
|
|
self::MEDIUM => 3600, // 1 hour
|
|
self::LOW => 86400, // 24 hours
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Gets notification channels for this urgency
|
|
*/
|
|
public function getNotificationChannels(): array
|
|
{
|
|
return match ($this) {
|
|
self::URGENT => ['sms', 'call', 'slack', 'email'],
|
|
self::HIGH => ['slack', 'email', 'push'],
|
|
self::MEDIUM => ['email', 'slack'],
|
|
self::LOW => ['email'],
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Gets retry strategy for failed notifications
|
|
*/
|
|
public function getRetryStrategy(): array
|
|
{
|
|
return match ($this) {
|
|
self::URGENT => [
|
|
'attempts' => 5,
|
|
'delays' => [30, 60, 120, 300, 600], // seconds
|
|
],
|
|
self::HIGH => [
|
|
'attempts' => 3,
|
|
'delays' => [60, 300, 900],
|
|
],
|
|
self::MEDIUM => [
|
|
'attempts' => 2,
|
|
'delays' => [300, 1800],
|
|
],
|
|
self::LOW => [
|
|
'attempts' => 1,
|
|
'delays' => [3600],
|
|
],
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Checks if this urgency requires immediate processing
|
|
*/
|
|
public function requiresImmediateProcessing(): bool
|
|
{
|
|
return in_array($this, [self::URGENT, self::HIGH]);
|
|
}
|
|
|
|
/**
|
|
* Gets maximum delay before alert must be sent
|
|
*/
|
|
public function getMaxDelay(): int
|
|
{
|
|
return match ($this) {
|
|
self::URGENT => 60, // 1 minute
|
|
self::HIGH => 300, // 5 minutes
|
|
self::MEDIUM => 1800, // 30 minutes
|
|
self::LOW => 86400, // 24 hours
|
|
};
|
|
}
|
|
}
|