Improve dashboard health and state recovery
This commit is contained in:
@@ -40,6 +40,7 @@ func New(socket string, svc *service.Service, log *slog.Logger) *Server {
|
||||
mux.HandleFunc("GET /v1/runs", s.runs)
|
||||
mux.HandleFunc("DELETE /v1/runs", s.clearRuns)
|
||||
mux.HandleFunc("GET /v1/backup-metrics", s.backupMetrics)
|
||||
mux.HandleFunc("GET /v1/dashboard-status", s.dashboardStatus)
|
||||
mux.HandleFunc("GET /v1/logs", s.logs)
|
||||
mux.HandleFunc("GET /v1/filesystem/directories", s.directories)
|
||||
mux.HandleFunc("GET /v1/workloads/{kind}", s.workloads)
|
||||
@@ -133,6 +134,9 @@ func (s *Server) runs(w http.ResponseWriter, _ *http.Request) { writeJSON(w, 200
|
||||
func (s *Server) backupMetrics(w http.ResponseWriter, _ *http.Request) {
|
||||
writeJSON(w, 200, s.service.BackupMetrics())
|
||||
}
|
||||
func (s *Server) dashboardStatus(w http.ResponseWriter, _ *http.Request) {
|
||||
writeJSON(w, 200, s.service.DashboardStatus(time.Now()))
|
||||
}
|
||||
func (s *Server) clearRuns(w http.ResponseWriter, _ *http.Request) {
|
||||
writeJSON(w, 200, map[string]int{"cleared": s.service.ClearRunHistory()})
|
||||
}
|
||||
@@ -364,7 +368,7 @@ func shouldLogRequest(r *http.Request, status int, duration time.Duration) bool
|
||||
return true
|
||||
}
|
||||
switch r.URL.Path {
|
||||
case "/v1/runs", "/v1/backup-metrics", "/v1/health", "/v1/logs":
|
||||
case "/v1/runs", "/v1/backup-metrics", "/v1/dashboard-status", "/v1/health", "/v1/logs":
|
||||
return false
|
||||
default:
|
||||
return true
|
||||
|
||||
Reference in New Issue
Block a user