{ "name": "health-checks", "type": "registry:ui", "title": "Health Checks", "description": "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.", "category": "Operations", "dependencies": [ "lucide-react@^1.39.0" ], "registryDependencies": [ "badge", "lib-motion", "lib-styles", "lib-utils", "sparkline" ], "files": [ { "path": "components/ui/health-checks.tsx", "type": "registry:ui", "content": "import type { ComponentProps, ReactNode } from 'react'\nimport { Check, TriangleAlert, X } from 'lucide-react'\nimport { Badge } from '@/components/ui/badge'\nimport { Sparkline } from '@/components/ui/sparkline'\nimport { enterFade } from '@/lib/motion'\nimport { radius, surface } from '@/lib/styles'\nimport { cn } from '@/lib/utils'\n\n/**\n * Endpoint probes: status, latency, and recent history.\n *\n * Latency carries a threshold so \"200 OK in 4 seconds\" reads as degraded rather\n * than healthy. A probe list that only reports the status code is why slow\n * outages get noticed by customers first.\n *\n * The sparkline is latency over recent probes, which turns \"is this getting\n * worse\" into something answerable at a glance — the single number cannot say\n * whether 400ms is the new normal or the start of something.\n */\nexport type HealthCheck = {\n id: string\n name: string\n url?: string\n status: 'healthy' | 'degraded' | 'down'\n /** Milliseconds. */\n latency?: number\n /** Above this, a healthy response still reads as degraded. */\n latencyThreshold?: number\n code?: number\n history?: number[]\n region?: ReactNode\n}\n\nconst STATUS = {\n healthy: { Icon: Check, tone: 'text-[var(--green-soft-foreground)]', color: 'green', label: 'Healthy' },\n degraded: { Icon: TriangleAlert, tone: 'text-[var(--amber-soft-foreground)]', color: 'amber', label: 'Degraded' },\n down: { Icon: X, tone: 'text-[var(--destructive-soft-foreground)]', color: 'destructive', label: 'Down' },\n} as const\n\n/** A slow success is not a success. */\nfunction effectiveStatus(check: HealthCheck) {\n if (check.status === 'healthy' && check.latencyThreshold && check.latency) {\n return check.latency > check.latencyThreshold ? 'degraded' : 'healthy'\n }\n return check.status\n}\n\nfunction HealthChecks({\n checks,\n className,\n ...props\n}: ComponentProps<'div'> & { checks: HealthCheck[] }) {\n return (\n
\n {check.name}\n {check.region}\n
\n {check.url && (\n\n {check.url}\n
\n )}\n\n {check.code}\n \n )}\n\n