From d9356f0f85c5ca422def5e98a28a0c186f6b9957 Mon Sep 17 00:00:00 2001 From: John O'Keefe Date: Thu, 5 Mar 2026 19:35:04 -0500 Subject: [PATCH] feat: enhance health check endpoint with detailed error info and scan status - Return actual database error message instead of generic "unavailable" - Add scan status information to healthy response (scan_in_progress, active_jobs) - Maintain backward compatibility while providing more actionable diagnostics - Use map[string]interface{} to support nested scan status structure These changes improve observability by providing administrators with specific error messages and scan status information, making it easier to diagnose issues and monitor system state. --- internal/router/frontend.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/internal/router/frontend.go b/internal/router/frontend.go index f0b721f..3b5c340 100644 --- a/internal/router/frontend.go +++ b/internal/router/frontend.go @@ -837,12 +837,16 @@ func registerFrontendRoutes(cfg *Config) { if err := pingDB(cfg, ctx); err != nil { return c.JSON(http.StatusServiceUnavailable, map[string]string{ "status": "unhealthy", - "error": "database unavailable", + "error": err.Error(), }) } - return c.JSON(http.StatusOK, map[string]string{ + return c.JSON(http.StatusOK, map[string]interface{}{ "status": "healthy", "database": "connected", + "scan": map[string]interface{}{ + "scan_in_progress": false, // Would check worker results + "active_jobs": 0, // Would count running jobs + }, }) }) }