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:
52
src/Framework/Database/Cache/ValueObjects/EntityMetrics.php
Normal file
52
src/Framework/Database/Cache/ValueObjects/EntityMetrics.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Framework\Database\Cache\ValueObjects;
|
||||
|
||||
use App\Framework\Core\ValueObjects\Duration;
|
||||
use App\Framework\Core\ValueObjects\Percentage;
|
||||
|
||||
/**
|
||||
* Individual entity metrics value object
|
||||
*/
|
||||
final readonly class EntityMetrics
|
||||
{
|
||||
public function __construct(
|
||||
public int $hits,
|
||||
public int $misses,
|
||||
public Percentage $hitRatio,
|
||||
public int $cacheSize,
|
||||
public Duration $averageAccessTime
|
||||
) {
|
||||
}
|
||||
|
||||
public function getTotalAccess(): int
|
||||
{
|
||||
return $this->hits + $this->misses;
|
||||
}
|
||||
|
||||
public function isPopular(): bool
|
||||
{
|
||||
return $this->getTotalAccess() > 100; // Arbitrary threshold
|
||||
}
|
||||
|
||||
public function isEfficient(): bool
|
||||
{
|
||||
return $this->hitRatio->isAbove(Percentage::from(60.0));
|
||||
}
|
||||
|
||||
public function toArray(): array
|
||||
{
|
||||
return [
|
||||
'hits' => $this->hits,
|
||||
'misses' => $this->misses,
|
||||
'hit_ratio' => $this->hitRatio->format(),
|
||||
'cache_size' => $this->cacheSize,
|
||||
'average_access_time_ms' => $this->averageAccessTime->toMilliseconds(),
|
||||
'total_access' => $this->getTotalAccess(),
|
||||
'is_popular' => $this->isPopular(),
|
||||
'is_efficient' => $this->isEfficient(),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user