Files
michaelschiemer/src/Framework/Performance/Contracts/PerformanceCollectorInterface.php
Michael Schiemer 55a330b223 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
2025-08-11 20:13:26 +02:00

79 lines
1.9 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Framework\Performance\Contracts;
use App\Framework\Performance\PerformanceCategory;
use App\Framework\Performance\PerformanceMetric;
interface PerformanceCollectorInterface
{
/**
* Start timing an operation
*/
public function startTiming(string $key, PerformanceCategory $category, array $context = []): void;
/**
* End timing an operation
*/
public function endTiming(string $key): void;
/**
* Measure a callable's execution time and memory usage
*/
public function measure(string $key, PerformanceCategory $category, callable $callback, array $context = []): mixed;
/**
* Record a metric value
*/
public function recordMetric(string $key, PerformanceCategory $category, float $value, array $context = []): void;
/**
* Increment a counter
*/
public function increment(string $key, PerformanceCategory $category, int $amount = 1, array $context = []): void;
/**
* Get all metrics, optionally filtered by category
*
* @return array<string, PerformanceMetric>
*/
public function getMetrics(?PerformanceCategory $category = null): array;
/**
* Get a specific metric by key
*/
public function getMetric(string $key): ?PerformanceMetric;
/**
* Get total request time in milliseconds
*/
public function getTotalRequestTime(): float;
/**
* Get total request memory usage in bytes
*/
public function getTotalRequestMemory(): int;
/**
* Get peak memory usage in bytes
*/
public function getPeakMemory(): int;
/**
* Reset all collected metrics
*/
public function reset(): void;
/**
* Check if performance tracking is enabled
*/
public function isEnabled(): bool;
/**
* Enable or disable performance tracking
*/
public function setEnabled(bool $enabled): void;
}