Show agent liveness, stuck/zombie detection and parse errors in admin
This commit is contained in:
@@ -67,6 +67,7 @@ func New(dataDir string, spa fs.FS) (*Server, error) {
|
||||
s.store.Close()
|
||||
return nil, fmt.Errorf("recover sessions: %w", err)
|
||||
}
|
||||
go s.agents.Watch()
|
||||
|
||||
return s, nil
|
||||
}
|
||||
@@ -393,6 +394,12 @@ func (s *Server) GetStatus(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
health, err := s.agents.Health(r.Context())
|
||||
if err != nil {
|
||||
writeError(w, http.StatusInternalServerError, err)
|
||||
return
|
||||
}
|
||||
|
||||
dbBytes := int64(0)
|
||||
for _, suffix := range []string{"", "-wal", "-shm"} {
|
||||
fi, err := os.Stat(s.store.Path() + suffix)
|
||||
@@ -413,6 +420,11 @@ func (s *Server) GetStatus(w http.ResponseWriter, r *http.Request) {
|
||||
QueuedTurns: usage.Queued,
|
||||
Caps: usage.Caps,
|
||||
RateLimits: usage.RateLimits,
|
||||
|
||||
AgentProcesses: health.Processes,
|
||||
Zombies: health.Zombies,
|
||||
StuckAfterSeconds: int(agents.StuckAfter / time.Second),
|
||||
ProtocolErrors: s.agents.ProtocolErrors(),
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user