Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better RabbitMQ check #238

Closed
JBKahn opened this issue Jan 27, 2020 · 3 comments
Closed

Better RabbitMQ check #238

JBKahn opened this issue Jan 27, 2020 · 3 comments

Comments

@JBKahn
Copy link

JBKahn commented Jan 27, 2020

RabbitMQ has an aliveness check that is a lot more reliable than the existing connection check used in this library. I use it a custom check on a similar health checker called django-watchman. It has caught several incidences that the connection check (what we originally used) did not.

That API check "Declares a test queue, then publishes and consumes a message. Intended for use by monitoring tools."

But you need to parse the URL or have the users declare the vhost/url separately. I used this snippet if that helps:

from urllib.parse import urlsplit, urlunsplit

vhost = broker_url.lstrip("/").rstrip("?")
split = urlsplit(broker_url)._replace(scheme="https", query="", path=f"/api/aliveness-test/{vhost}")
url = urlunsplit(split)

status = requests.get(url, verify=False).json()["status"] == 'ok'
@codingjoe
Copy link
Collaborator

Hi @JBKahn, thanks for the suggestion. Don't mind improving the check, but I am not using RabbitMQ myself right now, so I'd appreciated a pull request and would be delighted to review it. Best Joe

@JBKahn
Copy link
Author

JBKahn commented Feb 3, 2020

I'm not using RabbitMQ either right now, swapped to SQS and I've not even installed this library before. I figured I'd just offer up a suggestion, I'll circle back when I have some extra time but if anyone uses this and wants to work on it before I get there. Feel Free.

@codingjoe
Copy link
Collaborator

I see. I'll close it for now then and will repoen it, if there is more public demand.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants