Every console page that shows monitor status (monitors, incidents,
monitor details, evidence) went through one loader that read, for all of
the organization's monitors:
- the newest result per monitor and region, by scanning a day of raw
results;
- the bars of the selected range, from raw results for ranges up to 24h,
though only one page of monitors is shown;
- when each monitor first reported, scanning two days of results.
With 3000 monitors that took about a second, growing with the number of
results. Now:
- latest_results keeps the newest result per monitor and region,
updated as results are stored (migration 00055 fills it from the last
day);
- bars are loaded only for the monitors a page shows;
- first data is loaded per monitor on its page, and the monitor list asks
only for the organization's earliest data, by index;
- monitor, region and incident queries name the organization, so their
indexes are used instead of row security filtering whole tables.
Public status pages also read only their own monitors' latest results
and hourly buckets instead of the whole organization's.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
Organizations create receiver URLs for Alertmanager's webhook (token in
the path or as bearer). A monitor of type alertmanager is down while an
alert matching all its label matchers fires, and goes through the usual
evaluation, so confirmations, maintenance, notifications and SLA apply.
Results are recorded when the state changes and once per interval;
alerts Alertmanager stops repeating end after the monitor's stale period,
so a lost resolve cannot hold it down. An overview lists firing alerts
with the monitors following them and creates a prefilled monitor for the
others.
Closes#91
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
A heartbeat monitor has a secret ping URL instead of a target and
regions. Jobs call it with GET, HEAD or POST after each run, or /fail
with an optional message. When no ping arrives within the interval plus
a grace period, a failure is recorded and evaluated like a checker
result, so confirmations, maintenance and notifications apply. One API
replica at a time checks deadlines. The URL is shown only to members who
may edit the monitor, since it can report the job healthy.
Closes#27
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3