Skip to content

Feat/health metrics UI#87

Merged
smalex-z merged 2 commits intomainfrom
feat/health-metrics-ui
May 6, 2026
Merged

Feat/health metrics UI#87
smalex-z merged 2 commits intomainfrom
feat/health-metrics-ui

Conversation

@smalex-z
Copy link
Copy Markdown
Owner

@smalex-z smalex-z commented May 6, 2026

Description

Resolves #12

Changes Made

  • Updates and utilizes Agent health metrics and autorecovery

Testing

  • Tested locally
  • Added/updated unit tests
  • All tests passing

Screenshots (if applicable)

smalex-z added 2 commits May 6, 2026 03:34
…st Now

Five UI surfaces wired up against data the agent + monitor were already
collecting but never showing:

1. Agent metrics card (Machines page expanded row)
   New /api/machines/{id}/agent-status proxies the agent's /status through
   the rathole back-channel. The expanded row renders load avg, memory %,
   disk %, agent uptime, hostname, kernel — fetched on demand only when
   the row is open, so collapsed rows have zero cost.

2. Health-check sparkline + uptime %
   monitor.go now writes a HealthCheck row per probe (subject="tunnel:<id>")
   alongside its existing tunnel.Status update. The new
   db.GetHealthSummary aggregates {uptime_percent, recent[]} for the
   24-hour rolling window in one query. Frontend Sparkline renders the
   recent[] as 30 emerald/red squares, right-aligned newest-first.

3. Per-tunnel uptime % column
   New "Uptime" column on the Tunnels page shows colored % (green ≥99,
   amber ≥95, red below) + the sparkline + "last checked" relative time.
   Synthesized SSH/agent rows reuse the parent machine's "machine:<id>"
   subject — they share lifecycle, no point recording separately.

4. Last-seen / last-checked timestamps
   Machines page swaps the absolute toLocaleString last_seen for
   relativeTime ("2m ago"). Tunnel cells show the same. Hover for the
   exact timestamp via title attribute.

5. Test now button
   Per-machine button in the health panel calls the existing
   POST /machines/{id}/health/check endpoint and invalidates
   machine-health + agent-status caches so the new data renders
   immediately, instead of waiting for the next 60s health poll.

Helpers landed in frontend/src/lib/time.ts (relativeTime, formatBytes,
formatDuration). New components: Sparkline, MachineHealthPanel,
TunnelHealthCell. No new tables — everything builds on HealthCheck rows.
The previous cell stacked percentage / sparkline / last-checked across
three rows, doubling the height of every tunnel row. Visually noisy
once you have more than a few tunnels.

Now: just the colored percentage in the table cell. Hover (native
title attribute) reveals the full breakdown — uptime %, ok/total,
last-checked relative + absolute, latest error if any. Survives the
table wrapper's overflow-hidden which would clip a custom popover.

The fuller sparkline view stays on the per-machine health panel
(Machines page expanded row) where vertical space isn't constrained.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

Unit tests run: 275
Unit tests passed: 275
Test coverage: 24.6%

@smalex-z smalex-z merged commit 505b5b2 into main May 6, 2026
5 checks passed
@smalex-z smalex-z deleted the feat/health-metrics-ui branch May 6, 2026 03:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Health monitoring & Auto-recovery

1 participant