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:
2025-08-11 20:13:26 +02:00
parent 59fd3dd3b1
commit 55a330b223
3683 changed files with 2956207 additions and 16948 deletions

View File

@@ -0,0 +1,95 @@
<?php
declare(strict_types=1);
namespace App\Application\Analytics\ValueObject;
use App\Framework\Core\ValueObjects\Percentage;
/**
* Browser usage breakdown for analytics reporting
*/
final readonly class BrowserBreakdown
{
public function __construct(
public int $chrome,
public int $firefox,
public int $safari,
public int $edge,
) {
if ($chrome < 0 || $firefox < 0 || $safari < 0 || $edge < 0) {
throw new \InvalidArgumentException('Browser counts cannot be negative');
}
}
/**
* Create from legacy array format: ['Chrome' => 65, 'Firefox' => 20, ...]
* @param array<string, int> $data
*/
public static function fromArray(array $data): self
{
return new self(
chrome: $data['Chrome'] ?? 0,
firefox: $data['Firefox'] ?? 0,
safari: $data['Safari'] ?? 0,
edge: $data['Edge'] ?? 0,
);
}
public function getTotal(): int
{
return $this->chrome + $this->firefox + $this->safari + $this->edge;
}
public function getChromePercentage(): Percentage
{
return Percentage::fromRatio($this->chrome, $this->getTotal());
}
public function getFirefoxPercentage(): Percentage
{
return Percentage::fromRatio($this->firefox, $this->getTotal());
}
public function getSafariPercentage(): Percentage
{
return Percentage::fromRatio($this->safari, $this->getTotal());
}
public function getEdgePercentage(): Percentage
{
return Percentage::fromRatio($this->edge, $this->getTotal());
}
/**
* @return array<string, int>
*/
public function toArray(): array
{
return [
'Chrome' => $this->chrome,
'Firefox' => $this->firefox,
'Safari' => $this->safari,
'Edge' => $this->edge,
];
}
/**
* Legacy format for backward compatibility
* @return array<string, mixed>
*/
public function toAnalyticsArray(): array
{
return [
'Chrome' => $this->chrome,
'Firefox' => $this->firefox,
'Safari' => $this->safari,
'Edge' => $this->edge,
'chrome_percentage' => $this->getChromePercentage()->format(),
'firefox_percentage' => $this->getFirefoxPercentage()->format(),
'safari_percentage' => $this->getSafariPercentage()->format(),
'edge_percentage' => $this->getEdgePercentage()->format(),
'total' => $this->getTotal(),
];
}
}