Skip to content

feat(health): add application health statistics endpoint - #426

Merged
alex289 merged 5 commits into
feat/health-historyfrom
feat/health-stats-api
Oct 29, 2026
Merged

alex289 merged 5 commits into
feat/health-historyfrom
feat/health-stats-api

Conversation

@alex289

@alex289 alex289 commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Type of change

  • 🐛 Bug fix
  • 🚀 New feature
  • ❓ Other (please specify)

Description

Part 3/4 of #268. Adds GET /api/v1/applications/:id/health?range=24h|7d|30d (default 24h).

Response

  • current: latest recorded status and since when.
  • availability: healthy time / observed time in percent. null when nothing was observed. Time without data (unknown, e.g. agent offline) is excluded.
  • downtimeSeconds (degraded + unhealthy + stopped), noDataSeconds, incidentCount, longestIncidentSeconds, dataGapCount.
  • buckets: one per bar (1h / 3h / 12h → 24 / 56 / 60 bars), with seconds per status. A bucket shows its most severe failure; without failures it shows "no data" when that outweighs the healthy time.
  • incidents (newest first, max 100): consecutive degraded/unhealthy/stopped changes are merged into one incident with the most severe status and the failing services. Recorded unknown periods are listed as data gaps with their reason. Incidents that started before the range keep their real start and duration, but only the in-range part counts towards downtime.
  • trigger: an incident that starts during a deployment or image update, or up to 5 minutes after it, is linked to it (with the commit hash for deployments).

@codecov

codecov Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.15044% with 20 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
backend/internal/hub/healthhistory/stats.go 94.02% 12 Missing ⚠️
backend/internal/hub/routes/application_health.go 66.66% 8 Missing ⚠️

📢 Thoughts on this report? Let us know!

@alex289
alex289 force-pushed the feat/health-stats-api branch 4 times, most recently from 3e4079c to 4b8ff84 Compare October 28, 2026 20:36
Comment thread backend/internal/hub/healthhistory/stats.go
Comment thread backend/internal/hub/healthhistory/stats.go Outdated
Comment thread backend/internal/hub/healthhistory/stats.go
GET /api/v1/applications/:id/health?range=24h|7d|30d returns the
availability (healthy time / observed time), downtime, time without
data, bucketed bars for the availability chart and the incidents and
data gaps of the range. Incidents that start during or shortly after a
deployment or image update are linked to it.
…gers

Address review: ignore events that changed nothing, stop attributing
incidents to a stuck running event, cap the changes loaded per range and
sum buckets in a single pass.
@alex289
alex289 force-pushed the feat/health-stats-api branch from 8e0aa9a to 5c506a9 Compare October 29, 2026 09:32
@alex289
alex289 enabled stacked auto-merge (squash) October 29, 2026 09:33
@alex289
alex289 merged commit b527d23 into main Oct 29, 2026
12 checks passed
@alex289
alex289 deleted the feat/health-stats-api branch October 29, 2026 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend enhancement New feature or request hub

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants