Request: expose a port/endpoint for healthchecks
See original GitHub issueSummary
It would be helpful if apps using kombu were able to expose a port and/or endpoint for the purposes of healthchecks and monitoring. For example, a GET request to http://localhost:8080/running
might give a response of 200 - {"running": true}
while a kombu consumer is running.
Use cases
When running apps in kubernetes, it’s useful to be able to expose an endpoint for monitoring purposes (https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/). For example, as part of a k8s deployment you might have:
containers:
- name: my-container
image: myimage:latest
ports:
- containerPort: 8080
livenessProbe:
httpGet:
path: /running
port: 8080
readinessProbe:
httpGet:
path: /running
port: 8080
If the app crashes, kubernetes would then know to terminate the pod and bring up a new one.
Healthcheck or monitoring endpoints are also useful for situations where you need to know when an app running in a container is ready, for example in docker-compose stacks.
Proposal
The proposal is for kombu to stand up an HTTP endpoint, which returns an “OK” status code on being hit with an HTTP request, while a consumer is listening. This port would be used externally to monitor whether the app is still consuming.
If I have missed some functionality of kombu which could be used as an alternative, please let me know - I haven’t found anything in the documentation.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:6
- Comments:5 (1 by maintainers)
Top GitHub Comments
@jonadaly I’ve created a package for supporting TCP liveness check and with writing adapters for kombu consumers here: https://github.com/Anmol-Porwal18/kube_kombu
Kombu is not designed to be a full solution for executing queued tasks. It just abstracts the connection to message brokers and puts them under one interface.
You can implement such a healthcheck yourself or try using Celery’s ping task periodically.
I’m going to close this issue because it is out of scope for this library.