Class: HealthRegistry
Defined in: packages/common/src/health.ts:50
Holds what a service must satisfy before and while it serves, and answers the three questions separately because conflating them causes restart loops:
live: is the process alive? Fails only for a condition a restart would fix. Nothing is registered by default, so it answers 200 while the process runs, INCLUDING during a slow start. A liveness probe that fires during the agent's ordered startup restarts it forever.ready: can it serve? 503 until markStarted, then 503 while any readiness check fails. A readiness failure takes the instance out of rotation; it must never restart it.startup: has it finished booting? 503 until markStarted.
It never reports an error message: the endpoints are unauthenticated.
Constructors
Constructor
new HealthRegistry(
options?):HealthRegistry
Defined in: packages/common/src/health.ts:56
Parameters
options?
Returns
HealthRegistry
Accessors
started
Get Signature
get started():
boolean
Defined in: packages/common/src/health.ts:79
Whether markStarted has been called.
Returns
boolean
Methods
addLiveness()
addLiveness(
check):void
Defined in: packages/common/src/health.ts:69
Registers a condition for which a RESTART is the cure (a wedged event loop, a corrupt in-memory state). A broken dependency is not one: use addReadiness.
Parameters
check
Returns
void
addReadiness()
addReadiness(
check):void
Defined in: packages/common/src/health.ts:61
Registers a dependency whose failure takes the instance out of rotation.
Parameters
check
Returns
void
handle()
handle(
path):Promise<HealthReport|undefined>
Defined in: packages/common/src/health.ts:102
Answers by path, or undefined for a path that is not a health path.
Parameters
path
string
Returns
Promise<HealthReport | undefined>
live()
live():
Promise<HealthReport>
Defined in: packages/common/src/health.ts:84
Answers /health/live.
Returns
Promise<HealthReport>
markStarted()
markStarted():
void
Defined in: packages/common/src/health.ts:74
Declares boot complete: stores open, tenants loaded, transports bound.
Returns
void
ready()
ready():
Promise<HealthReport>
Defined in: packages/common/src/health.ts:89
Answers /health/ready.
Returns
Promise<HealthReport>
startup()
startup():
Promise<HealthReport>
Defined in: packages/common/src/health.ts:95
Answers /health/startup.
Returns
Promise<HealthReport>