Service status monitoring
Cap Status is a standalone product that checks public paths behind Cap and turns the results into a clear view of service health. It stores observations, derives availability states and incidents, and presents current status with recent history without depending on the main web application.
Product boundary
The status product runs as an independent application with its own deployment, storage, scheduler, and public domain. This separation lets the status page report when the main Cap application or its supporting services are unavailable.
The product uses small public canaries and health endpoints. It does not run full recording, upload, playback, or sign-in journeys. A healthy result means that the checked path responded as expected. It does not prove that every downstream dependency works.
The monitored service groups are:
- Website reachability.
- API and authentication provider reachability.
- Shared video access.
- Storage and media delivery.
- Media processing.
- Cloud rendering and available workers.
References: apps/…/README.md• L1-3 apps/…/README.md• L16-31
Monitoring flow
The monitoring flow turns scheduled observations into stored service state and a public snapshot. Visitors read the snapshot instead of probing Cap services from the browser.
This diagram shows how scheduled checks become the status view.
flowchart LR
S[Scheduled check] --> P[Service probes]
P --> D[Availability and latency results]
D --> I[State and incident rules]
I --> R[90-day monitoring record]
R --> A[Public status snapshot]
A --> U[Status page users]
The scheduler runs every five minutes in production. Each run probes the configured services in parallel, records the result, and updates current state, daily history, and incident records. Visitors read a short-lived cached snapshot that is refreshed about once per minute. The page labels the data as live only while the snapshot is fresh.
References: apps/…/README.md• L33-40 apps/…/status-page.tsx• L55-135
Availability model
The product uses four states to separate service health from missing monitoring data. A service is operational only when its endpoint responds successfully and any required health payload is valid.
| State | Meaning |
|---|---|
| Operational | The probe succeeded within the normal response-time limit. |
| Degraded | The endpoint responded, but it was slow or its health payload was not fully healthy. |
| Outage | The probe failed after a retry or the endpoint could not be reached. |
| Unknown | The service is not configured or its monitoring data is too old to trust. |
The monitor uses consecutive results to avoid changing the public state for one short failure. The first unhealthy result starts an issue. Two unhealthy results open an incident, and two successful results confirm recovery. A monitoring gap resets these counters and never counts as uptime. A daily history bar shows an outage only after the outage is confirmed; an unconfirmed unhealthy observation remains degraded in the history view.
Availability history covers 90 UTC calendar days. Its percentage is successful observed checks divided by all observed checks. Unmonitored time is not counted as successful time, and a period with no observations has no uptime percentage.
References: apps/…/state.ts• L11-72 apps/…/state.ts• L74-170 apps/…/state.test.ts• L31-83 apps/…/state.test.ts• L142-182
Public status experience
The status page gives users a current summary first, then service detail and incident context. It shows each service’s state, latest response time, last check, daily history, and observed uptime so users can assess both present and recent health.
Users can expand a service to read its description and inspect a selected day. The page also shows whether a service has not yet been configured, so missing monitoring is not presented as a failure or as healthy service.
The page stops polling when its tab is hidden. If the monitor or its storage cannot be reached, it shows that monitoring is unavailable rather than showing healthy data. Observations older than 15 minutes are shown as “No recent data”.
The public snapshot excludes service URLs, health payloads, and credentials. Incident history is limited to the recent monitoring window, while automatic incidents are in scope but notifications and manually written incident updates are not.
References: apps/…/status-page.tsx• L55-135 apps/…/status-page.tsx• L190-385 apps/…/service-row.tsx• L8-18 apps/…/service-row.tsx• L75-176 apps/…/types.ts• L47-62
Operational safeguards
The collector accepts only an authenticated scheduler request and runs only in production. A short lease prevents overlapping checks, and an interval guard prevents duplicate samples from being counted twice. A failed run does not block later checks because the lease expires.
The status application can show that its data is unavailable, but it cannot reliably alert on a complete outage of its deployment or scheduler. An external dead-man monitor must check that the public API remains reachable and that its checkedAt value stays current.
References: apps/…/README.md• L5-14 apps/…/README.md• L33-42
Related pages
The Status application and health checks page explains the application boundaries, probe rules, state transitions, public API, scheduled endpoint, deployment settings, and test guarantees in more detail.
Change checklist
When these files or sections are changed, remember to consider these:
- Keep the monitored service list, its public descriptions, and its deployment settings aligned. Missing or invalid endpoints must remain unknown rather than operational.
- Preserve the meaning of observed uptime when changing state or history rules. Empty days and monitoring gaps must not become successful checks.
- Keep scheduler authentication, production-only execution, the lease, and the duplicate-interval guard aligned. A change in one can create silent duplicate or missing samples.
- Keep the public snapshot free of service URLs, health payloads, and credentials when adding monitor fields.
- Keep the external dead-man check aligned with the API cache and stale-data limits. A cached response must not hide a stopped collector.
- Keep the history display aligned with confirmation rules. An unconfirmed unhealthy observation must not appear as a confirmed outage.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A service URL is missing or invalid | The service remains unknown and contributes no uptime | Validate HTTPS configuration and show unconfigured services as unknown |
| A probe fails once | The service may show degraded or start an issue, but no incident is opened yet | Retry the unhealthy probe and require two consecutive unhealthy checks |
| The collector stops or storage becomes unavailable | The page cannot provide trusted current health | Return monitoring-unavailable state and use an external dead-man monitor |
| A monitoring gap occurs | Counters reset and the gap is not counted as uptime or recovery | Treat stale data as unknown and require fresh consecutive checks |
| The status snapshot is served past its trust window | Users could see an old service state | Mark observations older than 15 minutes as unknown |
| An outage is recorded before confirmation | A brief failure could look like a confirmed outage in daily history | Mark a day as an outage only after consecutive unhealthy results confirm it |
Key files
| File | Why to read it |
|---|---|
| apps/…/README.md | Defines the product boundary, service coverage, monitoring promises, deployment needs, and operational limits. |
| apps/…/services.ts | Defines the service groups and the paths that represent each one. |
| apps/…/probe.ts | Shows what counts as a successful, slow, invalid, or failed observation. |
| apps/…/state.ts | Defines health states, incident confirmation, history, staleness, and public snapshot rules. |
| apps/…/route.ts | Connects the scheduler to probes, state updates, persistence, and concurrency protection. |
| apps/…/route.ts | Defines the public status data boundary and failure response. |
| apps/…/status-page.tsx | Shows how the product presents overall health, service status, incidents, and monitoring freshness to users. |
| apps/…/service-row.tsx | Shows how users inspect service state, daily history, uptime, latency, and the last check. |
| apps/…/state.test.ts | Guarantees that state transitions, stale data, monitoring gaps, observed uptime, and outage confirmation remain distinct. |