Documentation
¶
Overview ¶
Package monitor is the read-plane poller (plan §4): it discovers apps (one per Docker Compose project), builds the normalized BASIC health record for each service (plan §4.3), samples host metrics, holds the latest snapshot in memory for the UI, and persists metric samples. It only ever READS Docker (through the socket-proxy) — no write can originate here.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct {
Project string
DisplayName string
Services []ServiceStatus
Ops *ops.Result
WorkingDir string
ConfigFiles []string
}
App is one Compose project and its services. Ops is the canonical App Ops Interface record (nil when ops is not configured for this app — plan §4.3). WorkingDir/ConfigFiles come from the compose labels and let the write plane target `docker compose` for this project.
type Monitor ¶
type Monitor struct {
// contains filtered or unexported fields
}
Monitor runs the poll loop and publishes snapshots.
func New ¶
func New(db *store.DB, cli *docker.Client, host *hostmon.Sampler, interval, retention time.Duration, log *slog.Logger, prober *ops.Prober) *Monitor
New builds a Monitor. prober may be nil (ops probing disabled).
type ServiceStatus ¶
type ServiceStatus struct {
Service string
ContainerID string
Name string
Image string
State string
Health string
CPUPercent float64
MemBytes uint64
MemLimit uint64
RestartCount int
ExitCode int // last exit code (137 ≈ OOM/at-limit kill — used by the supervisor)
OOMKilled bool // the container's last stop was an OOM kill
HasRWVolume bool // a shared read-write bind/named volume (auto-scaling C3 disqualifier)
StatusText string
}
ServiceStatus is the normalized BASIC record for one container/service.
func (ServiceStatus) Running ¶
func (s ServiceStatus) Running() bool
Running reports whether the service container is running.
type Snapshot ¶
type Snapshot struct {
At time.Time
DockerOK bool
DockerErr string
Version string
Apps []App
Host hostmon.Sample
HostOK bool
HostErr string
}
Snapshot is the full read-plane view the UI renders.
func (*Snapshot) AppByProject ¶
AppByProject returns the app with the given project, or nil.