Documentation
¶
Overview ¶
Package machine works out what host this process is running on: which distribution and release, and how much machine there is to use.
It is its own package because two callers need the same answer and neither should depend on the other: the agent reports these facts to the controller so a pool asking for Ubuntu 24.04 can be placed correctly, and the configuration loader uses them to give an unnamed host a name that says what it is instead of whatever the cloud provider called it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultHostName ¶
func DefaultHostName() string
DefaultHostName is the name an unnamed host is given: what it is, then which one it is, in the grammar of internal/naming -- "zoomies-16vcpu-32gb-ubuntu-2404-build01".
A machine that would say nothing about itself falls back to its bare hostname rather than to the bare prefix, because "zoomies" is not a name and the hostname at least distinguishes two hosts.
Types ¶
type Facts ¶
type Facts struct {
// OS is the kernel, as Go names it: linux, darwin, windows.
OS string
// Distro and OSVersion are the distribution and its release, e.g.
// "ubuntu" and "24.04". Empty when the host cannot say, which is not an
// error: an unstated platform simply constrains nothing.
Distro string
OSVersion string
Arch string
// CPUs and MemoryMB are what this agent may actually use, which is not
// always what the machine has -- an agent in a container gets the cgroup's
// share, and reporting the host's 64 cores from inside a two-core cgroup
// would size every pool wrong.
CPUs int
MemoryMB int64
}
Facts is what this host actually is: which distribution and release it runs, and how much of it there is.
The controller needs all of it. The distribution and release decide whether a pool asking for Ubuntu 24.04 may be placed here -- "linux" cannot pick a runner image -- and the size is what lets a host be named for what it is rather than for whatever the cloud provider called it.
type Usage ¶
Usage describes the whole machine, including work not owned by Zoomies. A missing value means unmeasured, never idle. Linux procfs is the only source for now; other platforms retain reservation-based placement.
type UsageSampler ¶
type UsageSampler struct {
// contains filtered or unexported fields
}
UsageSampler takes CPU deltas between heartbeats without sleeping or asking Docker to do more work while it may already be overloaded.