diff --git a/internal/monitor/swarm/types.go b/internal/monitor/swarm/types.go new file mode 100644 index 0000000..1ef8f1f --- /dev/null +++ b/internal/monitor/swarm/types.go @@ -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"` +}