Documentation
¶
Overview ¶
Package lifecycle detects the discrete host lifecycle events the agent emits as the strong-delivery signal class: boot, unexpected_reboot, clean_shutdown, oom_kill and fs_readonly. It reads only unprivileged /proc files and persists two small 0600 files in the state directory: a state file (the last-seen boot_id and a periodically refreshed liveness timestamp) and a clean_shutdown marker written on SIGTERM. The marker is what makes the next boot a clean boot rather than an unexpected reboot.
Events are emitted into the shared event queue. On a crash there is no live send; the safety net is the exit spool plus the boot backfill: events queued here are spooled on exit and delivered after the next start.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Detector ¶
type Detector struct {
// contains filtered or unexported fields
}
Detector holds the lifecycle detection state and the persistence paths.
func (*Detector) Shutdown ¶
Shutdown runs on SIGTERM: it emits clean_shutdown and persists the marker so the next boot is recognised as clean. It is best-effort and must not block.
func (*Detector) Startup ¶
Startup runs once before the first report: it compares the current boot_id to the persisted one and emits boot or unexpected_reboot on a change, consumes the clean_shutdown marker, refreshes the persisted state, and seeds the oom and read-only-mount baselines so Tick reports only transitions.