AI latency monitor
Shown as Vigil, a made-up product
A service's latency streaming live against its objective. When a spike crosses the line, an on-call agent pins it, names the likely cause with its confidence, and offers the fix.
Installation
pnpm dlx shadcn@latest add "https://propui.dev/r/vigil-latency.json?token=…"Adds the piece to components/propui/06-vigil-latency/ and installs motion. Needs a free account: sign in and the command includes your token. Fonts load from Prop UI; download the zip to self-host them.
When to use
Reach for it when
- Watching one service's latency live against its objective, with an on-call agent that flags breaches.
- An incident card that explains a spike (likely cause, correlated signals, confidence) and offers the fix, Acknowledge, the runbook, a page and a mute.
- Any live metric where a person needs to pause the stream, read any point and come back to now without a jump.
Something else fits when
- Comparing options across many criteria: Radar compare is built for that.
- History over weeks or months: a static chart with a range picker reads better than a stream.
- Many services at once: a table of services with sparklines scales further.
Usage
Fills a full window: give it a container with a definite height.
import Piece from "@/components/propui/06-vigil-latency/Section";
export default function Page() {
return (
<main className="h-dvh w-full overflow-hidden">
<Piece />
</main>
);
}Replace SERVICE, ON_CALL, RANGES, REGIONS, SLO, EARLIER and the budget figures in data.ts, and feed real samples in place of sample() and spikeAt(). Wire fix(), Acknowledge, Page and Mute in Section.tsx to your incident tooling; the threshold, incident card and Incidents today list read from the stream.
Your data
Replace these and everything on screen follows.
SERVICE, ON_CALL{ name; product; owner }, { name; initials; role }- The header and who Page reaches.
TICKnumber- Milliseconds between samples (250).
RANGES{ id; label; ms; bucket; ticks }[]- The 30 s, 5 m and 1 h windows: their span, how many samples fold into one point, and the axis labels.
PCTS, REGIONSPct[], RegionId[]- The percentile switch and the region chips.
SLO, SENS_FACTORRecord<Pct, number>, Record<Sensitivity, number>- The objective line per percentile, and how Low, Normal and High move the line the agent flags at.
sample(), spikeAt(), baseline()(i, region, pct) => number- The simulated feed: a pure function of the tick, so every screen draws the same picture.
causeFor()(k, region) => { headline; signals; confidence; action }- The likely cause, signals, confidence and suggested fix on each incident.
EARLIER, BUDGET_TOTAL_MIN, BUDGET_START_MIN{ time; value; cause; status }[], number, number- Earlier incidents in Incidents today, and the error budget meter.
Interactions
- Watch the stream scroll; the big number rolls to the latest value with the change against a minute ago.
- Pause to freeze the view (it counts what arrives), then resume to glide back to now.
- Switch the range, percentile and region; on phones these sit in the View menu.
- Hover the chart, or focus it and use the arrow keys, to read any point: value, time and the gap to p50.
- When a spike crosses the line, the agent pins a callout and opens an incident: run the suggested fix, Acknowledge, open the runbook, page the on-call, or mute similar alerts for an hour.
- Set the agent's sensitivity, and export the window as CSV or the chart as PNG.
Keyboard
- ←or→
- On the chart, read the previous or next point; in a segmented control, move the choice.
- HomeorEnd
- On the chart, jump to the oldest or newest point.
- Esc
- On the chart, clear the reading.
Behaviour
Read from the code: roles, motion, breakpoints and what runs.
Accessibility
- The chart is a focusable group described as a chart, labelled with the service, percentile, range and objective; a polite live region announces each reading.
- Range, percentile and sensitivity are radio groups; region chips are toggle buttons in a labelled group.
- The error budget is a meter with its value, and the incident card is a polite live region.
- Runbook reports aria-expanded; the toast is a status.
- Breaches are marked by the tinted band, the callout text and the incident, never by colour alone.
Motion
- The stream scrolls continuously on a canvas, and new samples ease in at the head; the scale eases when the range or percentile changes, and views crossfade.
- The big number rolls on one spring; the incident card arrives with a spring and the confidence meter fills.
- Resuming after a pause glides to now instead of jumping.
- Reduced motion steps the stream one sample at a time, jumps the number and skips the glide.
Responsive
- The card is 1180px wide and shrinks with the screen; the agent panel is a 320px column beside the chart.
- Below 960px the agent panel moves under the chart.
- Below 640px the toolbar folds into a View menu that opens across the card, the stats stack, the number shrinks and the chart is 220px tall.
Performance
- One animation frame loop draws the canvas; browsers pause it while the tab is hidden, and React does not render per frame.
- The number, delta and pause count update through refs, not state.
- No images: one local font file, a canvas and inline SVG.
Notes for AI
Give your coding assistant the Markdown, not a screenshot.
- Keep the feed a pure function of the tick so server and client agree; start it after mount.
- Derive the threshold from SLO and the sensitivity factor; never hard-code it in copy.
- Light and dark follow the nearest data-theme attribute above the piece, or the system setting. Keep colours in the tokens at the top of post.css; the canvas reads them.
/p/vigil-latency/markdownThe whole library for assistants: llms.txt, or the MCP server in AI tools and MCP.