Files
main.tsmain
What you'll learn
- Tell liveness from readiness: whether to restart a process, and whether to send it traffic
- Build health checks with TerminusModule, HealthCheckService.check() and @HealthCheck(), and read the result: status, info, error, details
- Check dependencies with the built-in indicators: a microservice over its transport, an HTTP service by URL
- Write an indicator of your own with HealthIndicatorService: up, degraded or down, with the data an operator needs
Press Run tests to start the app. Its log appears here.Graded endpoints
Liveness checks nothing beyond the process answering, and @HealthCheck() forbids caching the answer
Every dependency is up: the cats service answered a TCP connection, the vet clinic's status page answered 200, and three kennels are free
Two kennels are left
The kennels indicator says degraded: still serving, so the status stays 200, but the overall status says so
One kennel left
No kennel left
One indicator is down, so the check fails with 503: an orchestrator stops sending traffic, and error names what is wrong while info keeps what is fine
Liveness does not look at dependencies: a gateway with no free kennels needs no restart
The gateway's own routes are unchanged