interface IHealthService
Since 0.2.0

Health service contract for registering and checking health indicators.

Resolved via CAPABILITIES.HEALTH ('health').

Examples

Example 1

const health = ctx.services.get<IHealthService>('health');
health.registerIndicator('custom', async () => ({ status: 'up' }));
const report = await health.check();

Methods

registerIndicator(
name: string,
): void

Registers a health indicator.

check(): Promise<HealthReport>

Runs all registered indicators and returns the aggregated report.

checkLive(): Promise<HealthReport>

Runs only the liveness indicator (the built-in "self" indicator).

checkReady(): Promise<HealthReport>

Runs all contributed indicators for readiness.

Usage

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