@samveys/health
Endpoint liveness dan readiness, sadar shutdown
Daftar ini dibaca dari versi 1.0.2; jalankan pnpm sync untuk memperbaruinya.
import { health } from '@samveys/health'
Fungsi (1)
health
Fungsi
The `@samveys/health` plugin: `GET <path>/live` (process is up) and `GET <path>/ready` (every check passes; 503 with details otherwise, and 503 from the moment shutdown begins).
function health(options?: HealthOptions): import("@samveys/core").Plugin<HealthOptions | undefined>;
Diekspor dari packages/health/src/plugin.ts
Interface (4)
HealthCheckReport
Interface
Tidak ada komentar dokumentasi.
interface HealthCheckReport {
readonly ok: boolean;
readonly message?: string;
}
Diekspor dari packages/health/src/contracts.ts
HealthCheckResult
Interface
Outcome of one readiness check.
interface HealthCheckResult {
readonly ok: boolean;
readonly message?: string;
}
Diekspor dari packages/health/src/contracts.ts
HealthOptions
Interface
Tidak ada komentar dokumentasi.
interface HealthOptions {
/** Extra readiness checks by name. */
readonly checks?: Readonly<Record<string, HealthCheckFunction>>;
/** URL prefix of the endpoints (default `/health`): `<path>/live` and `<path>/ready`. */
readonly path?: string;
/** Per-check timeout in ms (default 5000). */
readonly timeout?: number;
}
Diekspor dari packages/health/src/contracts.ts
ReadinessReport
Interface
Tidak ada komentar dokumentasi.
interface ReadinessReport {
/** `shutting_down` once `app:terminating` fired. */
readonly status: 'ok' | 'unavailable' | 'shutting_down';
readonly checks: Readonly<Record<string, HealthCheckReport>>;
}
Diekspor dari packages/health/src/contracts.ts
Tipe (1)
HealthCheckFunction
Tipe
A named readiness check passed to `health({ checks })`; a throw or rejection counts as a failure.
type HealthCheckFunction = (signal: AbortSignal) => HealthCheckResult | Promise<HealthCheckResult>;
Diekspor dari packages/health/src/contracts.ts