From 083e522bb7ba4721d024a4a149274bb87770481b Mon Sep 17 00:00:00 2001 From: William Valentin Date: Wed, 18 Mar 2026 10:08:54 -0700 Subject: [PATCH] feat: add swarm monitor types --- internal/monitor/swarm/types.go | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 internal/monitor/swarm/types.go 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"` +}