Documentation
¶
Overview ¶
Package telemetry persists the dispatch story the control plane otherwise drops: finished jobs (job_runs), agent liveness (agent_status), and a live transition feed (dispatch_events). Its daily sweep also enforces retention on the enrollment tables that share the pool. Everything here is best-effort — a telemetry failure must never fail dispatch — and hosted-only: the OSS single-host controller gets the no-op Recorder.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Beat ¶
type Beat struct {
UpdateProtocol int
Version string
UpdateState string
UpdateError string
Key string
Name string
Orgs []string
Labels []string
Capacity int
Busy int
// QueueDepth is how many jobs the agent reports as pending. On a blocked
// host it is the difference between "idle" and "stalled with work waiting".
QueueDepth int
DiskFree uint64
DiskTotal uint64
Blocked bool
}
Beat is one agent heartbeat: its liveness identity plus the capacity and image-store state carried on the poll. Blocked means the agent is refusing work because its store is under the host's free-space floor.
type Noop ¶
type Noop struct{}
Noop is the OSS default: telemetry disabled.
func (Noop) AgentUpdateTarget ¶ added in v0.2.5
func (Noop) JobUpdated ¶ added in v0.2.8
type PG ¶
type PG struct {
// contains filtered or unexported fields
}
PG is the Neon-backed Recorder, sharing the control plane's pool. All writes are handed to a single drain goroutine so a slow or stalled DB never adds latency to the dispatch handlers that emit telemetry.
func NewWithPool ¶
NewWithPool applies the telemetry schema and starts the drain worker and daily retention sweep, both stopping when ctx is done.
func (*PG) AgentUpdateTarget ¶ added in v0.2.5
func (*PG) JobUpdated ¶ added in v0.2.8
type Recorder ¶
type Recorder interface {
AgentUpdateTarget(context.Context, string) (UpdateTarget, error)
// JobResolved records the terminal dispatch state (done|failed|lost|
// offer-expired) with the scheduling timestamps carried on the record.
JobResolved(rec dispatch.Record, status string)
// JobUpdated merges GitHub job identity and lifecycle timestamps without erasing completion data.
JobUpdated(r ledger.Record)
// AgentSeen upserts agent liveness, capacity and host state under the
// caller's liveness key. Called on every poll; implementations throttle writes.
AgentSeen(b Beat)
// Event appends to the live transition feed and notifies listeners.
Event(org, dispatchID, event string, payload map[string]any)
}
Recorder receives lifecycle signals from the server and webhook.