immudb icon indicating copy to clipboard operation
immudb copied to clipboard

[Feature] Improved rest health endpoints

Open SimoneLazzaris opened this issue 3 years ago • 0 comments

What would you like to be added or enhanced

It would be useful to have a simple HTTP endpoint, to use with docker and kubernetes health check. Even better, we could have an endpoint for liveness probe and another for readyness.

Why is this needed

To fully integrate immudb into a more complex architecture we need ways to know that the database is really alive. The easiest way to accomplish this in kubnernetes (and in docker) is to expose an HTTP endpoint that responds with 200 messages when everything it's ok, and with a 5xx message when is not.

Additional context Ideally, we should have at least two endpoints, let's say /livez for liveness and /readyz for readiness. They can be exposed on port 9497, alongside prometheus stats

A dedicated gorouting (let's call it watchdog) should periodically scan every database configured and check for its current health, status, or both. If every database responds in a timely fashion, then the instance is sane and requests to the liveness endpoint are successful.

If immudb could keep track of successful grpc transaction, it could also expose this information to the watchdog goroutine, so that it can stop incoming requests when the database is being overwhelmed; this can be done by responding a 4xx or 5xx code to the readiness probe.

Those information can also be exposed using prometheus metrics.

SimoneLazzaris avatar Feb 10 '22 16:02 SimoneLazzaris