Repository navigation
Description
Rewritten on 2026-11-21 to fit the project plan: the product is fully operable by AI agents through MCP (north star P8, D14, D15) and the backend is written in Effect (D16). The previous version is in this issue's edit history.
Problem
An average hides slow tails. Percentiles have to be honest, without storing every sample.
Scope
- Add a fixed log-scale histogram (about 32 buckets from 1 ms to 60 s) to the existing hourly and daily statistics rows through the normal
kuma.dbupgrade path. Only successful checks are counted, so timeouts are not response times. - Histograms merge exactly. p50, p95, and p99 are computed from merged buckets and labelled approximate (≈, with the bucket error stated).
- Sample counts are shown next to the percentiles. Legacy rows without a histogram report "unavailable", never a fabricated value.
- The percentiles appear in the details chart and in MCP
get_response_times.
Acceptance criteria
- Known distributions come out within the stated bucket error, including after merges.
- Storage per row is fixed.
- The upgrade test passes, and legacy data shows "unavailable".
- Before/after numbers for write cost and database growth are in
docs/perf/.
Cut from the original issue
The per-location dimension, minute-level rollups, and the sketch-algorithm exploration.
Constraints
Keep Bun, Vue, one compiled executable and SQLite (kuma.db), with the supported Kuma importer. No required hosted service, extra database, worker deployment, Node/npm fallback or new distribution path. Backend code is written in Effect (north star D16, house style in docs/effect.md): dependencies are Effect services provided through layers, expected failures are tagged errors, and every input is decoded with Schema. Use direct @/ imports; no new barrel, ad-hoc registry, broad any facade or @ts-nocheck. Code passes the TS 7 strict typecheck and the @cloudflare/oxlint-config lint (D17). Make additive schema changes through the existing upgrade path; keep legacy rows meaningful.
Implement the idea independently. Staygreen is a design reference at the pinned revision, licensed FSL-1.1-MIT; do not transplant its source, CSS, illustrations or branding into this MIT project.
Source starting points
- iglo:
src/server/uptime-calculator.ts - iglo:
src/server/heartbeat-data-plane.ts - iglo:
src/components/PingChart.vue - Staygreen reference:
probe/rollup.ts - Staygreen reference:
src/lib/agent-contract.ts - Staygreen reference:
src/components/charts.tsx
Plan placement
Reconciled on 2026-11-21 with the project plan (docs/roadmap.md) and the fixed decisions (docs/north-star.md). If this issue and those documents still disagree, raise it instead of choosing.
- Stage: 6.
- Depends on: none. Shows freshness context once feat: expose observation freshness and measured uptime coverage #78 lands.
- Foundation first: starts after the Stage F exit gate (Stage F exit gate: foundation complete #120) closes, meaning types, guardrails, and the Effect rewrite are done. Build on the Effect services that own each responsibility after Stage F. File and module names in this issue describe the code as of 2026-10-28 and may have moved.
- Agent parity (P8): every capability this issue adds to the UI ships with its MCP tool in the same PR or stack, calling the same Effect service (D14). Writes follow the feat: command layer with idempotent, scoped, previewable writes #84 conventions (
request_id,dry_run, scopes). - GitHub dependencies: the blockers are also set as GitHub issue dependencies (see the issue sidebar).
Activity
[-]feat: add bounded latency distributions with honest aggregation[/-][+]feat: p50/p95 response times from fixed latency histograms[/+]