Healthcheck Prometheus quick start
import { createHealthManager, runtimeMetricsCollector,} from "@nexload-sdk/healthcheck";import { toPrometheusText } from "@nexload-sdk/healthcheck-prometheus";
const health = createHealthManager({ service: { name: "api" }, runtime: "auto", collectors: [runtimeMetricsCollector()],});
const report = await health.run("all");const body = toPrometheusText(report, { prefix: "nexload", includeDescriptions: true,});
console.log(body);The output includes aggregate health and collector series, for example:
nexload_health_status{service="api",scope="all",status="ok"} 1nexload_service_uptime_seconds{service="api",scope="all"} 42The exact uptime value varies. The status series proves the report was serialized; the runtime series proves report-level collector metrics were included.
Return body with the Prometheus text content type and cache-control: no-store.
Read the Core quick start for manager scopes. If a
series is absent or rejected, use Troubleshooting.