Health Checks

Endpoint probes with status, latency and history. A 200 that takes four seconds reads as degraded — a probe list that only reports the status code is why slow outages get noticed by customers first.

src/components/ui/health-checks.tsx

About

From the component's own source, where it was written.

Endpoint probes: status, latency, and recent history.

Latency carries a threshold so "200 OK in 4 seconds" reads as degraded rather than healthy. A probe list that only reports the status code is why slow outages get noticed by customers first.

The sparkline is latency over recent probes, which turns "is this getting worse" into something answerable at a glance — the single number cannot say whether 400ms is the new normal or the start of something.

Install

npx astralyx-ui add health-checks

Usage

import { HealthChecks } from '@/components/ui/health-checks'

<HealthChecks checks={checks} />

Composer

Change the props and the source below follows.

  • API

    https://api.astralyx.dev/health

    42 ms200Healthy
  • Checkout

    https://api.astralyx.dev/checkout/health

    1840 ms200Degraded
  • Registry

    https://registry.astralyx.dev/health

    503Down
  • Docs

    https://astralyx.dev

    88 ms200Healthy
Props
tsx
<HealthChecks checks={checks} />

Examples

Probes

API

Generated from the source, so it cannot fall behind the code. One table per exported component, then hooks, functions and types.

HealthChecks

Endpoint probes: status, latency, and recent history.

Extends ComponentProps<'div'>.

PropTypeDefaultDescription
checksHealthCheck[]required{ id, name, url?, status, latency?, latencyThreshold?, code?, history?, region? }.

Functions

FunctionSignatureDescription
effectiveStatus(check: HealthCheck) => 'down' | 'healthy' | 'degraded'Exported, so a summary elsewhere agrees with the row.

Types

HealthCheck

FieldTypeDescription
idstring—
namestring—
url?string—
status'healthy' | 'degraded' | 'down'—
latency?numberMilliseconds.
latencyThreshold?numberAbove it a healthy response is reported as degraded.
code?number—
history?number[]Recent latencies as a sparkline — a single number cannot say whether 400ms is normal or the start of something.
region?ReactNode—