-
Notifications
You must be signed in to change notification settings - Fork 6
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
feat(api): add /health endpoint to check workers #345
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I understand celery and flask, it looks alright to me. Since this is an additional endpoint, it shouldn't break anything else, even if there is a bug in the code.
sketch_map_tool/routes.py
Outdated
result: list = celery_app.control.ping(timeout=1) | ||
if result: | ||
return {"status": "ok"} | ||
return {"status": "fail"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this still returns a 2xx
status code. Is this on purpose?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its on purpose. I do not know of any good alternative. The endpoint did what it is supposed to do, check the celery worker and reports on it.
I think it is fine like this.
sketch_map_tool/routes.py
Outdated
@@ -220,6 +220,15 @@ def download(uuid: str, type_: REQUEST_TYPES) -> Response: | |||
return send_file(file, mimetype, download_name=download_name) | |||
|
|||
|
|||
@app.route("/api/ping") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is ping
the term you want to use? I often saw health
or maybe status
as endpoint name. The term ping
also refers to ICMP requests and not necessarily to TCP/QUIC requests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/status
is already in use for querying the status of a certain task (e.g. map generation). /health
I like but seems to encompass more than one ping to on part of the system. On the other hand, one can add new parts to the health
endpoint over time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
renamed to /health
514db46
to
1ab3f15
Compare
f25573b
to
966025a
Compare
No description provided.