package handlers import ( "net/http" "zlh-agent/internal/metrics" ) func HandleProcessMetrics(w http.ResponseWriter, r *http.Request) { if r.Method != http.MethodGet { writeJSONError(w, http.StatusMethodNotAllowed, "GET only") return } resp, stopped, err := metrics.ProcessMetrics() if err != nil { writeJSONError(w, http.StatusInternalServerError, err.Error()) return } if stopped { writeJSON(w, http.StatusNotFound, map[string]any{"status": "stopped", "process": resp.Process}) return } writeJSON(w, http.StatusOK, resp) }