PlatformFleetHealthService
in package
FinalYes
Builds a privacy-safe operational snapshot of the tenant fleet.
Table of Contents
Properties
- $backupCriticalHours : int
- $backupPolicy : PlatformBackupPolicyService|null
- $backupWarningHours : int
- $connection : Connection
Methods
- __construct() : mixed
- Constructor.
- snapshot() : array<string, mixed>
- activeJobsByTenant() : array<string, array<string, mixed>>
- ageHours() : int|null
- Whole hours between a stored timestamp and now, if parseable.
- dateTime() : DateTimeImmutable
- Normalize an optional snapshot time.
- higherRisk() : string
- Return the more severe risk level.
- keyBy() : array<string, array<string, mixed>>
- latestBackupsByTenant() : array<string, array<string, mixed>>
- latestPlatformBackup() : array<string, mixed>|null
- loadBackupThresholds() : void
- Derive backup staleness thresholds from the global backup policy.
- metricsByTenant() : array<string, array<string, mixed>>
- operationIssues() : array<int, array<string, mixed>>
- riskWeight() : int
- Map risk labels to sort weight.
- scheduleIssues() : array<int, array<string, mixed>>
- tenantHealth() : array<string, mixed>
- tenantRows() : array<int, array<string, mixed>>
Properties
$backupCriticalHours
private
int
$backupCriticalHours
= 72
$backupPolicy read-only
private
PlatformBackupPolicyService|null
$backupPolicy
= null
$backupWarningHours
private
int
$backupWarningHours
= 24
$connection read-only
private
Connection
$connection
Methods
__construct()
Constructor.
public
__construct(Connection $connection[, PlatformBackupPolicyService|null $backupPolicy = null ]) : mixed
Parameters
- $connection : Connection
- $backupPolicy : PlatformBackupPolicyService|null = null
snapshot()
public
snapshot([DateTimeInterface|string|null $now = null ][, int $tenantLimit = 500 ]) : array<string, mixed>
Parameters
- $now : DateTimeInterface|string|null = null
- $tenantLimit : int = 500
Return values
array<string, mixed>activeJobsByTenant()
private
activeJobsByTenant(string $staleBefore) : array<string, array<string, mixed>>
Parameters
- $staleBefore : string
Return values
array<string, array<string, mixed>>ageHours()
Whole hours between a stored timestamp and now, if parseable.
private
ageHours(mixed $value, DateTimeImmutable $now) : int|null
Parameters
- $value : mixed
- $now : DateTimeImmutable
Return values
int|nulldateTime()
Normalize an optional snapshot time.
private
dateTime(DateTimeInterface|string|null $value) : DateTimeImmutable
Parameters
- $value : DateTimeInterface|string|null
Return values
DateTimeImmutablehigherRisk()
Return the more severe risk level.
private
higherRisk(string $current, string $candidate) : string
Parameters
- $current : string
- $candidate : string
Return values
stringkeyBy()
private
keyBy(array<int, array<string, mixed>> $rows, string $key) : array<string, array<string, mixed>>
Parameters
- $rows : array<int, array<string, mixed>>
- $key : string
Return values
array<string, array<string, mixed>>latestBackupsByTenant()
private
latestBackupsByTenant() : array<string, array<string, mixed>>
Return values
array<string, array<string, mixed>>latestPlatformBackup()
private
latestPlatformBackup() : array<string, mixed>|null
Return values
array<string, mixed>|nullloadBackupThresholds()
Derive backup staleness thresholds from the global backup policy.
private
loadBackupThresholds() : void
Falls back to the daily defaults when the policy is unreadable (e.g. platform_settings not yet migrated).
metricsByTenant()
private
metricsByTenant(string $since) : array<string, array<string, mixed>>
Parameters
- $since : string
Return values
array<string, array<string, mixed>>operationIssues()
private
operationIssues(DateTimeImmutable $now) : array<int, array<string, mixed>>
Parameters
- $now : DateTimeImmutable
Return values
array<int, array<string, mixed>>riskWeight()
Map risk labels to sort weight.
private
riskWeight(string $risk) : int
Parameters
- $risk : string
Return values
intscheduleIssues()
private
scheduleIssues(DateTimeImmutable $now) : array<int, array<string, mixed>>
Parameters
- $now : DateTimeImmutable
Return values
array<int, array<string, mixed>>tenantHealth()
private
tenantHealth(array<string, mixed> $tenant, array<string, mixed> $metrics, array<string, mixed>|null $backup, array<string, mixed>|null $activeJob, DateTimeImmutable $now) : array<string, mixed>
Parameters
- $tenant : array<string, mixed>
- $metrics : array<string, mixed>
- $backup : array<string, mixed>|null
- $activeJob : array<string, mixed>|null
- $now : DateTimeImmutable
Return values
array<string, mixed>tenantRows()
private
tenantRows(int $limit) : array<int, array<string, mixed>>
Parameters
- $limit : int