fix(metrics): fetch fleet data concurrently and refresh server access

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.
This commit is contained in:
Andras Bacsai
2026-10-13 11:56:39 +02:00
parent faca466cd6
commit d77580cb35
11 changed files with 343 additions and 37 deletions
+36
View File
@@ -0,0 +1,36 @@
<?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]]];
}
}