karapace
karapace copied to clipboard
Implement endpoint for health check
Bugs in dependency libraries can cause the karapace APIs to become unresponsive, restarting the process is usually a valid and quick fix for the problem. To properly implement the restart a /status
endpoint is necessary, this endpoint has to peform some request through the kafka client to make sure communication is working properly.
I have used the /brokers
endpoint for this. I haven't looked in detail at what it does, but hope it will catch most situations.
/brokers
is a good idea, and it will cover the Admin client used in the REST APIs. But we need to do some additional work to also include the schema registry APIs, the motivation behind this issue was two bugs we found, that caused the API to become unresponsive (https://github.com/dpkp/kafka-python/pull/2189 and https://github.com/dpkp/kafka-python/pull/2194). To figure out if the clients are not stuck in a infinite loop we have to use each one of them individually.