class HealthService
implements IHealthService
Since 0.2.0

Default implementation of IHealthService.

Manages indicator registration and aggregation for health checks.

M90b: selected indicators run CONCURRENTLY, each raced against a runtime-owned deadline (indicatorTimeoutMs, default 5,000). Sequential awaiting multiplied outage latency — a 2-second outage across six dependency indicators took 12+ seconds, the measured X29-2 /health — and one never-settling indicator left the whole endpoint pending forever. A timeout is recorded as { status: 'down', data: { reason: 'timeout' } }, a rejection as { status: 'down', data: { reason: 'error' } } with the thrown value never serialized into the report; each indicator's latency is measured individually; and checks is assembled in registration order so the report's shape is stable even though execution is not.

Constructors

HealthService(
runtime: IRuntimeServices,
options?: { indicatorTimeoutMs?: number; }
)

Creates a new health service.

Parameters
runtime: IRuntimeServices

Runtime services for time and diagnostics

optional
options: { indicatorTimeoutMs?: number; }

Aggregation options

Methods

check(): Promise<HealthReport>

{@inheritDoc IHealthService.check}

{@inheritDoc IHealthService.checkLive}

Only runs the "self" indicator.

{@inheritDoc IHealthService.checkReady}

Runs all indicators except "self".

registerIndicator(
name: string,
): void

{@inheritDoc IHealthService.registerIndicator}

Usage

import { HealthService } from "health-plugin/src/index.ts";