fleet

package
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 22, 2026 License: MIT Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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"`
}

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).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL