-
Notifications
You must be signed in to change notification settings - Fork 4
Merge duplicate pingEndpoint/checkEndpointHealth in status.go #102
Copy link
Copy link
Closed
Labels
refactorCode restructure, no behavior changeCode restructure, no behavior change
Milestone
Description
Problem
status.go has two near-identical functions:
pingEndpoint(url, kind) string— returns emoji (✅, ❌,⚠️ )checkEndpointHealth(url, kind) bool— returns true/false
Both build the check URL the same way (append /ping for backend, /api/health for Grafana), create an http.Client with the same timeout (8s), make the same GET request, and check the same status code range. The only difference is the return type.
Fix
Refactor into one function and have the other call it:
`go
func checkEndpointHealth(url string, kind string) bool {
// ... shared logic ...
}
func pingEndpoint(url string, kind string) string {
if checkEndpointHealth(url, kind) {
return "✅"
}
return "❌"
}
`
(The
Acceptance Criteria
- One shared implementation for endpoint health checking
-
statuscommand output unchanged (same emojis, same JSON fields) -
go build ./...andgo test ./...pass
Reactions are currently unavailable
Metadata
Metadata
Labels
refactorCode restructure, no behavior changeCode restructure, no behavior change