Skip to content

Commit

Permalink
Merge pull request #23 from VMGWARE/Update-API-Routes
Browse files Browse the repository at this point in the history
feat: Add disk space utilization to health check response
  • Loading branch information
Vahn Gomes authored Jul 28, 2023
2 parents 639ce1d + 0030a54 commit fbe2bdf
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/app/Http/Controllers/API/HealthCheckController.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ public function index(): JsonResponse
}
}

// Disk space
$diskspace = disk_free_space('/') / disk_total_space('/') * 100;
$diskspace = round($diskspace, 2);

// Response
$response = [
'status' => $status,
Expand All @@ -47,8 +51,8 @@ public function index(): JsonResponse
'timestamp' => now()->toAtomString(),
'app_version' => config('app.version'),
'api_version' => 'v1',
'diskspace' => disk_free_space('/') / disk_total_space('/') * 100,
'latency' => round(microtime(true) - LARAVEL_START, 3),
'diskspace' => $diskspace,
'latency' => round(microtime(true) - LARAVEL_START, 3) . 's',
'dependencies' => $dependencies
]
];
Expand Down

0 comments on commit fbe2bdf

Please sign in to comment.