Skip to content

Commit

Permalink
debug: logging
Browse files Browse the repository at this point in the history
  • Loading branch information
loks0n committed Jun 17, 2024
1 parent af04a7e commit 958e761
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Orchestration/Adapter/DockerAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,12 @@ public function getStats(?string $container = null, array $filters = []): array

$stats = \json_decode($result['response'], true);

if (! isset($stats['id']) || ! isset($stats['precpu_stats']) || ! isset($stats['cpu_stats']) || ! isset($stats['memory_stats']) || ! isset($stats['networks'])) {
var_dump($containerId);
var_dump($result['response']);
throw new Orchestration('Failed to get stats for container: '.$containerId);
}

// Calculate CPU usage
$cpuDelta = $stats['cpu_stats']['cpu_usage']['total_usage'] - $stats['precpu_stats']['cpu_usage']['total_usage'];
$systemCpuDelta = $stats['cpu_stats']['system_cpu_usage'] - $stats['precpu_stats']['system_cpu_usage'];
Expand Down

0 comments on commit 958e761

Please sign in to comment.