feat: add swarm monitor types

This commit is contained in:
William Valentin
2026-03-18 10:08:54 -07:00
parent 22bc16bf51
commit 083e522bb7
+29
View File
@@ -0,0 +1,29 @@
package swarm
import "time"
// ServiceSnapshot holds the collected state for one docker-compose service.
type ServiceSnapshot struct {
Name string `json:"name"`
Role string `json:"role"`
ContainerState string `json:"container_state"` // running/stopped/exited/missing
HealthState string `json:"health_state"` // healthy/unhealthy/starting/none
Status string `json:"status"` // healthy/degraded/down
UptimeSec int64 `json:"uptime_sec,omitempty"`
HTTPStatus *int `json:"http_status,omitempty"`
Extra map[string]any `json:"extra,omitempty"`
}
// SwarmSnapshot holds a rolled-up snapshot of all labeled services.
type SwarmSnapshot struct {
Services []ServiceSnapshot `json:"services"`
Issues Issues `json:"issues"`
Timestamp time.Time `json:"timestamp"`
}
// Issues flags notable problems detected during a poll.
type Issues struct {
ServiceDown []string `json:"service_down,omitempty"`
ServiceDegraded []string `json:"service_degraded,omitempty"`
LLMCooldowns bool `json:"llm_cooldowns,omitempty"`
}