Contracts
HealthCheckInterface
v1.0.0Exposes a HealthStatus DTO for monitoring dashboards and system checks.
Namespace
use Meteorack\Sdk\Core\Contracts\HealthCheckInterface;How To Use It
- Implement this on modules that should report a machine-readable runtime health status to dashboards or automated checks.
- Base the returned HealthStatus on the same upstream dependencies, credentials, and caches your module uses during real requests.
Works Well With
Methods
public function getHealthStatus(): HealthStatusReturns the current module health status DTO.
Example
bootstrap.php
<?php
declare(strict_types=1);
use Meteorack\Sdk\Core\Contracts\HealthCheckInterface;
use Meteorack\Sdk\Core\DTOs\HealthStatus;
use Meteorack\Sdk\RuntimeWp\AbstractModule;
class ReportsModule extends AbstractModule implements HealthCheckInterface
{
public function getSlug(): string { return 'reports'; }
public function getName(): string { return 'Reports'; }
public function getVersion(): string { return '1.0.0'; }
public function getHealthStatus(): HealthStatus
{
if ($this->getSetting('api_key') === null) {
return HealthStatus::degraded('Missing API key', ['setting' => 'api_key']);
}
return HealthStatus::healthy('Ready to sync');
}
}
return new ReportsModule();