Probes log locally only while the hub is unreachable; the hub confirms silences with that log

Probe: no access log, nothing written while reports get through. When the hub
can't be reached, failed reports go to data/outage.jsonl and unsent results to
data/backlog.jsonl (survives restarts). The first report that gets through
uploads both and they are deleted.

Hub: a probe that misses reports gets a "Not reporting" incident. When it
reports again, the runs from its outage log become confirmed "Hub unreachable"
incidents; the rest of the silence (probe off or restarting) is dropped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
neil 2026-11-04 20:50:30 -08:00
parent 462525b1e2
commit be727949c1
13 changed files with 449 additions and 32 deletions

View file

@ -1,5 +1,6 @@
// Shared bits for the views.
import { el } from './ui.js';
import { ms } from './fmt.js';
/** The screen frame: toolbar, scrolling pane, status bar. Returns the parts. */
export function screen(root, toolbarItems) {
@ -73,3 +74,30 @@ export function every(ms, fn) {
const t = setInterval(() => { if (!document.hidden) fn(); }, ms);
return () => clearInterval(t);
}
// Incident cells, shared by Network health and a probe's page. kind "report" rows are stretches
// when a probe didn't report; the probe's local outage log confirms them when it reports again.
const METHOD_NAMES = { icmp: 'Ping', http: 'HTTP', dns: 'DNS' };
export function incidentTarget(i) {
if (i.kind === 'report') return el('span', {}, i.label);
return el('span', {}, i.label, el('span.muted.small', {}, ` ${i.methods.map((m) => METHOD_NAMES[m] || m).join(', ')}`));
}
export function incidentTypeText(i) {
if (i.kind !== 'report') return undefined;
return i.confirmed ? 'Hub unreachable' : 'Not reporting';
}
export function incidentChecks(i) {
if (i.kind === 'report') return i.confirmed ? `${i.failed} failed reports` : 'No reports';
return i.failed ? `${i.failed}/${i.samples} failed` : `${i.samples} slow`;
}
export function incidentDetail(i) {
if (i.kind === 'report') {
if (i.confirmed) return `The probe logged that it couldn’t reach the hub${i.error ? `: ${i.error}` : ''}`;
return 'Kept if the probe’s log shows it couldn’t reach the hub, removed if it was off';
}
return i.error || (i.max_latency ? `peak ${ms(i.max_latency)}` : '');
}