move into sonardesk

This commit is contained in:
Mark Gregory
2026-10-12 14:50:13 +01:00
parent 5f0d2ceb72
commit 38b4a7406f
879 changed files with 24021 additions and 1 deletions
@@ -0,0 +1,24 @@
<?php
namespace Modules\CloudDevOps\Services;
use Illuminate\Support\Facades\Http;
use Modules\CloudDevOps\Models\DeploymentHealthCheck;
final class HealthCheckRunner
{
public function run(DeploymentHealthCheck $check): DeploymentHealthCheck
{
$started = microtime(true);
try {
$response = Http::timeout(10)->get((string) $check->endpoint);
$status = $response->status() === $check->expected_status ? 'healthy' : 'unhealthy';
$message = 'HTTP '.$response->status();
} catch (\Throwable $e) {
$status = 'unhealthy';
$message = $e->getMessage();
} $check->update(['status' => $status, 'response_time_ms' => (int) ((microtime(true) - $started) * 1000), 'checked_at' => now(), 'message' => $message]);
return $check->refresh();
}
}