loadgate

package
v0.136.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: BSD-3-Clause Imports: 5 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 loadgate reads the machine's load averages and refuses a measurement taken on a busy machine.

⛔ WHY A GATE AND NOT A NOTE. This fleet's standing rule is "never measure at a 1-minute load above ~8", and on 2026-11-16 it was broken by the session that had written a gate for it the day before. That gate (go-tex/engine's cmd/internal/loadguard) covers the two corpus tools and nothing else, so `go test -bench` — the measurement actually taken — was guarded by nothing.

⛔⛔ AND THE DAMAGE WAS A RATIO, WHICH IS THE CASE THAT LOOKS SAFE. The figure published was a SHARE: a serial suite on one side, a benchmark on the other, both taken in the same session, which feels like it should cancel. It does not. Retaken on a quiet machine:

                                 loaded     quiet    factor
suite, 2012 tests, serial        58.04 s    17.76 s  ×3.3
BenchmarkLoadLaTeX                3.658 ms   2.621 ms ×1.4
the share they make              "12.7%"    29.7%

The wall clock stretches far more than a tight in-process loop, so the RATIO moves by more than either half. The wrong figure was published as a refutation of a colleague's finding, and it ruled out the candidate that was right.

⚠ DUPLICATION, SAID OUT LOUD. go-tex/engine's cmd/internal/loadguard is the same sixty lines with the same threshold. Two copies of one rule is what this fleet's own mandate forbids, and neither can import the other: both are `internal`. Raised as its own question rather than resolved here by making a third copy — see the pull request that added this package.

Index

Constants

View Source
const Threshold = 8.0

Threshold is the load average above which this fleet does not measure.

Variables

This section is empty.

Functions

func Banner(a Averages, override string) string

Banner is the line a tool prints above its result so the conditions travel with the number. An override is NAMED in it, so a reader can see the measurement was taken deliberately on a busy machine.

Types

type Averages

type Averages struct {
	One, Five, Fifteen float64
}

Averages are the three load averages, as uptime reports them.

func Check

func Check(override string) (Averages, error)

Check reports whether a measurement may proceed, returning the averages so the caller can print them WITH its result: the conditions belong in the report, not in the operator's memory.

⚠ BOTH the 1-minute AND the 5-minute average must be under the threshold. A 1-minute dip under a loaded 5-minute average is not a quiet machine, and reading only the first minute passed a run at 1-min 6.93 with a 5-min of 10.00.

⛔ An unreadable machine is refused, not waved through. override is a REASON, never a boolean, and the caller stamps it into the output.

func Read

func Read() (Averages, error)

Read returns the machine's load averages.

Linux exposes them in /proc/loadavg; macOS does not, so sysctl is asked for vm.loadavg. ⛔ A platform where neither works returns an ERROR rather than a zero Averages: zero would read as an idle machine, and this fleet has paid for a scan that could not read reporting zero.

func (Averages) String

func (a Averages) String() string

Jump to

Keyboard shortcuts

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