Documentation
¶
Overview ¶
Package fleet is the fleet-observability contract and aggregator: the curated health summary a lord publishes about itself (Health), and the consumer that assembles a live network-wide view from those summaries (Aggregator).
This is a mechanism, not a domain concern: it describes the runtime itself (nodes, lords, thralls, their state), never application data. It is the network-wide sibling of the per-node observer dashboard - each lord publishes its own summary on aether._fleet.<app>.<lord_id> (wire.FleetHealth), and an aggregator subscribes to aether._fleet.> (wire.FleetHealthAll) to hold the whole fleet. The raw supervision channels (aether._lord.>) stay node-local and are never exported; this curated summary is what an operator deliberately exports to see the fleet.
Health is a JSON wire contract: any language can consume the summary off the subject, so an application dashboard is not tied to Go.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Aggregator ¶
type Aggregator struct {
// contains filtered or unexported fields
}
Aggregator holds a live view of the fleet, keyed by (app, lord_id), assembled from the health summaries lords publish. It is transport-agnostic at its core (Ingest/Snapshot); Subscribe wires it to a NATS connection. Staleness is derived per node from that node's own published interval, so a slow-publishing node is not flagged as often as a fast one.
func NewAggregator ¶
func NewAggregator() *Aggregator
NewAggregator returns an empty aggregator with the default staleness/eviction multiples and clock.
func (*Aggregator) Ingest ¶
func (a *Aggregator) Ingest(h Health)
Ingest records a health summary, stamping it with the current time as its last-seen, and prunes nodes that have been silent far beyond staleness (e.g., a restarted lord's old pid) so the map stays bounded across restarts.
func (*Aggregator) Snapshot ¶
func (a *Aggregator) Snapshot() []NodeView
Snapshot returns the current fleet, sorted by (app, lord_id), with staleness computed now.
func (*Aggregator) Subscribe ¶
func (a *Aggregator) Subscribe(nc *nats.Conn) (*nats.Subscription, error)
Subscribe wires the aggregator to a bus: it subscribes to every lord's health subject and ingests each summary. A malformed message is skipped, never fatal.
type Health ¶
type Health struct {
App string `json:"app"`
LordID string `json:"lord_id"` // "<hostname>-<pid>" - the node/instance identifier
Strategy string `json:"strategy"` // supervision strategy of the app
NatsMode string `json:"nats_mode"` // embedded | external
TS int64 `json:"ts"` // unix millis this summary was built
IntervalMs int64 `json:"interval_ms"` // publish cadence, so a consumer can derive staleness
Thralls []ThrallHealth `json:"thralls"`
}
Health is one lord's curated summary of its own state, published periodically. Identity travels here (App + LordID), not in the subject, so an aggregator keys off the payload and a lord id with dots (an FQDN hostname) needs no special handling.
type NodeView ¶
type NodeView struct {
Health
Stale bool `json:"stale"` // no update within staleMultiple publish intervals
LastSeen int64 `json:"last_seen"` // unix millis of the last summary received
}
NodeView is one node's line in the fleet snapshot: its last health summary plus derived liveness.
type ThrallHealth ¶
type ThrallHealth struct {
Name string `json:"name"`
Status string `json:"status"` // starting | ready | down | stale
Scope string `json:"scope"`
Restart string `json:"restart"`
Replicas int `json:"replicas"`
Durable bool `json:"durable"`
EventLog bool `json:"event_log"`
Dynamic bool `json:"dynamic"`
Live bool `json:"live"`
Restarts uint64 `json:"restarts"`
GaveUp uint64 `json:"gave_up"`
HeartbeatMisses uint64 `json:"heartbeat_misses"`
MailboxDepth int `json:"mailbox_depth"`
Processed uint64 `json:"processed"`
RSSBytes int64 `json:"rss_bytes"`
CPUPercent float64 `json:"cpu_percent"`
// Self-description carried across the fleet: the thrall's self-declared version and the
// operations it answers (from its heartbeat), the reason of its most recent failure, and the
// deployment metadata the operator declared in the manifest. All optional.
Version string `json:"version,omitempty"`
CallOps []string `json:"call_ops,omitempty"`
CastOps []string `json:"cast_ops,omitempty"`
LastError string `json:"last_error,omitempty"`
LastErrorMs int64 `json:"last_error_ms,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
}
ThrallHealth is one thrall's line in the summary: its topology plus its live status and the self-metrics the lord already tracks (mirrors the observer dashboard's per-thrall view).