- Add DISCOVERY_LOG_LEVEL=debug - Add DISCOVERY_SHOW_PROGRESS=true - Temporary changes for debugging InitializerProcessor fixes on production
58 lines
1.6 KiB
PHP
58 lines
1.6 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Framework\ErrorBoundaries\Events;
|
|
|
|
use App\Framework\Core\ValueObjects\Duration;
|
|
use App\Framework\Core\ValueObjects\Timestamp;
|
|
|
|
/**
|
|
* Event fired when boundary execution succeeds
|
|
*/
|
|
final readonly class BoundaryExecutionSucceeded implements BoundaryEventInterface
|
|
{
|
|
public readonly string $eventType;
|
|
|
|
public readonly Timestamp $occurredAt;
|
|
|
|
public readonly string $severity;
|
|
|
|
public function __construct(
|
|
public string $boundaryName,
|
|
public Duration $executionTime,
|
|
public ?string $message = null,
|
|
public array $context = [],
|
|
) {
|
|
$this->eventType = 'boundary.execution.succeeded';
|
|
$this->occurredAt = Timestamp::now();
|
|
$this->severity = 'info';
|
|
}
|
|
|
|
public function getEventId(): string
|
|
{
|
|
return "boundary_success_{$this->boundaryName}_{$this->occurredAt->toFloat()}";
|
|
}
|
|
|
|
public function shouldAlert(): bool
|
|
{
|
|
return false; // Success events typically don't trigger alerts
|
|
}
|
|
|
|
public function toArray(): array
|
|
{
|
|
return [
|
|
'event_id' => $this->getEventId(),
|
|
'event_type' => $this->eventType,
|
|
'boundary_name' => $this->boundaryName,
|
|
'execution_time_ms' => $this->executionTime->toMilliseconds(),
|
|
'execution_time_human' => $this->executionTime->toHumanReadable(),
|
|
'message' => $this->message,
|
|
'context' => $this->context,
|
|
'occurred_at' => $this->occurredAt->toIsoString(),
|
|
'severity' => $this->severity,
|
|
'should_alert' => $this->shouldAlert(),
|
|
];
|
|
}
|
|
}
|