- Add comprehensive health check system with multiple endpoints - Add Prometheus metrics endpoint - Add production logging configurations (5 strategies) - Add complete deployment documentation suite: * QUICKSTART.md - 30-minute deployment guide * DEPLOYMENT_CHECKLIST.md - Printable verification checklist * DEPLOYMENT_WORKFLOW.md - Complete deployment lifecycle * PRODUCTION_DEPLOYMENT.md - Comprehensive technical reference * production-logging.md - Logging configuration guide * ANSIBLE_DEPLOYMENT.md - Infrastructure as Code automation * README.md - Navigation hub * DEPLOYMENT_SUMMARY.md - Executive summary - Add deployment scripts and automation - Add DEPLOYMENT_PLAN.md - Concrete plan for immediate deployment - Update README with production-ready features All production infrastructure is now complete and ready for deployment.
116 lines
2.8 KiB
PHP
116 lines
2.8 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Tests\Unit\Framework\LiveComponents\Profiling;
|
|
|
|
use App\Framework\Random\RandomGenerator;
|
|
use App\Framework\Telemetry\OperationHandle;
|
|
use App\Framework\Telemetry\TelemetryService;
|
|
|
|
/**
|
|
* Simple Test Implementation of TelemetryService
|
|
*
|
|
* Minimal implementation for testing without complex dependencies.
|
|
* Provides valid OperationHandle instances but doesn't track anything.
|
|
*/
|
|
final class SimpleTelemetryService implements TelemetryService
|
|
{
|
|
/** @var array<string, mixed> */
|
|
private array $recordedMetrics = [];
|
|
|
|
/** @var array<string, mixed> */
|
|
private array $recordedEvents = [];
|
|
|
|
public function __construct(
|
|
private readonly RandomGenerator $randomGenerator
|
|
) {}
|
|
|
|
public function startOperation(
|
|
string $name,
|
|
string $type,
|
|
array $attributes = []
|
|
): OperationHandle {
|
|
// Create a valid OperationHandle with this service instance
|
|
$operationId = 'test-op-' . bin2hex($this->randomGenerator->bytes(4));
|
|
return new OperationHandle($operationId, $this);
|
|
}
|
|
|
|
public function trace(
|
|
string $name,
|
|
string $type,
|
|
callable $callback,
|
|
array $attributes = []
|
|
): mixed {
|
|
// Just execute the callback without tracing
|
|
return $callback();
|
|
}
|
|
|
|
public function recordMetric(
|
|
string $name,
|
|
float $value,
|
|
string $unit = '',
|
|
array $attributes = []
|
|
): void {
|
|
$this->recordedMetrics[] = [
|
|
'name' => $name,
|
|
'value' => $value,
|
|
'unit' => $unit,
|
|
'attributes' => $attributes,
|
|
];
|
|
}
|
|
|
|
public function recordEvent(
|
|
string $name,
|
|
array $attributes = [],
|
|
string $severity = 'info'
|
|
): void {
|
|
$this->recordedEvents[] = [
|
|
'name' => $name,
|
|
'attributes' => $attributes,
|
|
'severity' => $severity,
|
|
];
|
|
}
|
|
|
|
/**
|
|
* End an operation (called by OperationHandle)
|
|
*/
|
|
public function endOperation(string $operationId, ?string $status = null, ?string $errorMessage = null): void
|
|
{
|
|
// No-op for testing
|
|
}
|
|
|
|
/**
|
|
* Add an attribute to an operation
|
|
*/
|
|
public function addOperationAttribute(string $operationId, string $key, mixed $value): void
|
|
{
|
|
// No-op for testing
|
|
}
|
|
|
|
/**
|
|
* Get recorded metrics for test assertions
|
|
*/
|
|
public function getRecordedMetrics(): array
|
|
{
|
|
return $this->recordedMetrics;
|
|
}
|
|
|
|
/**
|
|
* Get recorded events for test assertions
|
|
*/
|
|
public function getRecordedEvents(): array
|
|
{
|
|
return $this->recordedEvents;
|
|
}
|
|
|
|
/**
|
|
* Clear all recorded data
|
|
*/
|
|
public function clear(): void
|
|
{
|
|
$this->recordedMetrics = [];
|
|
$this->recordedEvents = [];
|
|
}
|
|
}
|