mirror of
https://github.com/coollabsio/coolify.git
synced 2026-11-06 13:10:37 -04:00
Run metric requests in batches of eight workers, isolate endpoint failures, and preserve CPU and memory history when Sentinel lacks a summary endpoint. Repair Sentinel tokens before creating workers and bound SSH fetch timeouts. Reauthorize team servers on refresh and hydration, clear stale metrics after transfers or deletions, and resolve container metadata for team ID zero. Use only root filesystem samples when mount fields are present, while supporting legacy disk data. Add regression coverage for concurrent workers, access changes, endpoint failures, and disk mapping.
37 lines
954 B
PHP
37 lines
954 B
PHP
<?php
|
|
|
|
namespace Tests\Support;
|
|
|
|
use App\Services\SentinelMetricsClient;
|
|
|
|
class ConcurrentMetricsClient extends SentinelMetricsClient
|
|
{
|
|
public function summary(): ?array
|
|
{
|
|
return [
|
|
'online' => true, 'cpu' => 25.0, 'memUsed' => 100, 'memTotal' => 200,
|
|
'diskUsed' => 10, 'diskTotal' => 100, 'diskPercent' => 10.0,
|
|
'load1' => 0.4, 'netRx' => 5.0, 'netTx' => 1.0,
|
|
];
|
|
}
|
|
|
|
public function containersCurrent(): array
|
|
{
|
|
return [['id' => 'container-'.$this->server->uuid, 'cpu' => 25.0]];
|
|
}
|
|
|
|
public function history(string $metric, string $range): array
|
|
{
|
|
if ($metric === 'disk') {
|
|
throw new \RuntimeException('Disk endpoint unavailable.');
|
|
}
|
|
|
|
return [[1000, $metric === 'cpu' ? 25.0 : 100.0]];
|
|
}
|
|
|
|
public function networkHistory(string $range): array
|
|
{
|
|
return ['rx' => [[1000, 5.0]], 'tx' => [[1000, 1.0]]];
|
|
}
|
|
}
|