Hanne Voss

Hanne Voss

Writes most of Pegel’s Go code and most of its release notes. Backend developer in Weststadt by day, and Pegel gets her evenings from Tuesday to Thursday.

Changelog

v0.9.0: Checks from two places

An alert fires only when two probes agree, which ends the false alarms from a flaky home line. Since this release, interval counts seconds.

The version mark v0.9.0 above the line Checks from two places.

Post

Why an alert needs two probes

From May to October, one probe on a home line sent us 121 false alarms. Two probes that had to agree sent one.

2 min

A diagram: probe home and probe vps each report down to a box labelled agree?, which points to example.org. An alert fires only when both probes see the outage.

TIL

A TOML decoder can list the keys it ignored

toml.DecodeFile from BurntSushi/toml returns a MetaData, and its Undecoded() lists every key in the file that matched no field. Pegel 0.9.0 uses it to refuse a typo such as intervall instead of ignoring it.

md, err := toml.DecodeFile(path, &cfg)
if err != nil {
	return nil, err
}
if keys := md.Undecoded(); len(keys) > 0 {
	return nil, fmt.Errorf("%s: unknown key %q", path, keys[0].String())
}

Before, a misspelt key fell back to its default without a word, and nobody suspects a default.

TIL

Go’s http.Client waits forever by default

An http.Client without Timeout never gives up on a server that accepts the connection and then sends nothing. The probe hung on exactly that for 40 minutes during testing.

client := &http.Client{Timeout: 10 * time.Second}

Timeout covers the whole request, from dialling to the last byte of the body. For a check, that is the number we want.

PostPaid members only

The home probe is slower, and we kept it

Our home probe answers two to three times slower than the VPS, and slowest at noon. It still sees things the VPS cannot.

1 min

A line chart of p95 check latency over one day. The home probe ranges from 39 to 66 ms and peaks at noon, while the VPS probe stays between 17 and 24 ms.
Buy Logbuch