Feat/historic health status#110
Open
vtnphan wants to merge 3 commits into
Open
Conversation
vtnphan
marked this pull request as ready for review
July 24, 2026 05:52
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
Summary
Adds historical downtime tracking for the components on the admin System Status dashboard (Seqera API, compute env, Tower Agent), so admins can see how often and for how long each has been degraded/unhealthy over time — without storing a row for every poll.
Changes
SystemStatusIncidentmodel /system_status_incidentstable (migrationa6ee1af2c156): one row per downtime period per component (started_at,ended_atnull while ongoing,status,message). Only degraded/unhealthy periods are recorded — healthy checks write nothing, so storage scales with actual outages, not polling frequency.app/services/health.py:_update_incidentsruns on every real probe refresh (insiderefresh_db_cache) and opens/closes/splits incident rows on status transitions (recovers to healthy → close; still down at same severity → leave open, refresh message; severity changes e.g. degraded → unhealthy → close and open a new one). Addedget_incidents(window/component query),_summarize_downtime(incident count, downtime seconds, uptime % — clipped to the query window), andto_downtime_dict.app/schemas/health.py:ComponentIncident,ComponentDowntimeSummary,ComponentDowntime,SystemStatusDowntimeResponse.app/routes/system_status.py: newGET /admin/api/system-status/history?hours=&component=(admin-gated, same as the existing/admin/api/system-status), returns per-component incidents + downtime summary for the requested window (max 30 days).app/templates/admin/system_status.html: new "History" card with a 24h/7d/30d window switch — an all-green bar per component with colored segments only where it was actually down (positioned by real incident start/end), a short list of recent incidents (start/end-or-"ongoing"/duration/message), and per-component uptime %.tests/test_services_health.py,tests/test_routes_admin_system_status.py).How to Test
uv sync --all-extrasuv run alembic upgrade head(createssystem_status_incidents)uv run pytest tests/test_services_health.py tests/test_routes_admin_system_status.py -vuv run pytest tests/ -v/admin/system-status. To see an incident recorded, temporarily break a probe (e.g. an invalidSEQERA_ACCESS_TOKEN), let a refresh run, then restore it — the History card should show one incident with a start and end time.Type of change
Checklist