A good health check tests what the service needs to serve users: a quick query to the database, the cache, the queue. It answers fast, has no side effects, needs no login or only a key with no other rights, and returns a small JSON body that says which check failed.
There are usually two kinds. A liveness check says the process runs and shouldn’t be restarted; it stays simple. A readiness check says the instance can take traffic now, dependencies included, so a load balancer or Kubernetes can route around it. External monitoring wants the readiness kind.
Be careful with dependencies you don’t control. If the health check fails whenever a third-party API is slow, every instance can be taken out of service at once. Report those as degraded in the body, and keep the status code for failures that really stop the service.
Example
GET /health
HTTP/1.1 200 OK
Content-Type: application/json
Cache-Control: no-store
{"status":"ok","checks":{"database":"ok","cache":"ok"}}
A monitor checks the status code and that $.status equals ok. A 503, a timeout or any other value fails the check.