Enable Discovery debug logging for production troubleshooting
- Add DISCOVERY_LOG_LEVEL=debug - Add DISCOVERY_SHOW_PROGRESS=true - Temporary changes for debugging InitializerProcessor fixes on production
This commit is contained in:
48
src/Framework/Discovery/Memory/GuardResult.php
Normal file
48
src/Framework/Discovery/Memory/GuardResult.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Framework\Discovery\Memory;
|
||||
|
||||
/**
|
||||
* Result of a guard check
|
||||
*/
|
||||
final readonly class GuardResult
|
||||
{
|
||||
public function __construct(
|
||||
public MemoryStatusInfo $memoryStatus,
|
||||
public array $actions,
|
||||
public int $checkNumber,
|
||||
public bool $emergencyMode
|
||||
) {
|
||||
}
|
||||
|
||||
public function hasAction(GuardAction $action): bool
|
||||
{
|
||||
return in_array($action, $this->actions, true);
|
||||
}
|
||||
|
||||
public function hasAnyLeakDetection(): bool
|
||||
{
|
||||
return $this->hasAction(GuardAction::CRITICAL_LEAK_DETECTED) ||
|
||||
$this->hasAction(GuardAction::HIGH_LEAK_DETECTED) ||
|
||||
$this->hasAction(GuardAction::MEDIUM_LEAK_DETECTED) ||
|
||||
$this->hasAction(GuardAction::LOW_LEAK_DETECTED);
|
||||
}
|
||||
|
||||
public function requiresImmediateAction(): bool
|
||||
{
|
||||
return $this->hasAction(GuardAction::EMERGENCY_CLEANUP) ||
|
||||
$this->hasAction(GuardAction::CRITICAL_LEAK_DETECTED);
|
||||
}
|
||||
|
||||
public function toArray(): array
|
||||
{
|
||||
return [
|
||||
'memory_status' => $this->memoryStatus->toArray(),
|
||||
'actions' => array_map(fn ($action) => $action->value, $this->actions),
|
||||
'check_number' => $this->checkNumber,
|
||||
'emergency_mode' => $this->emergencyMode,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user