this post was submitted on 19 Sep 2023
1117 points (98.8% liked)

Programmer Humor

32192 readers
456 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
1117
submitted 1 year ago* (last edited 1 year ago) by [email protected] to c/[email protected]
you are viewing a single comment's thread
view the rest of the comments
[–] hansl 32 points 1 year ago (1 children)

Just have an endpoint in your API (like /health) that doesn’t do anything but return “ok”.

So if your database goes down, your filesystem is full, etc, that endpoint will always return “ok” with HTTP 200. That way you can setup a ping monitoring service that will trigger an alarm if the process itself is down.

You of course need more pinging for the database server etc. But at least you know which service is down instead of “the whole website is down and we don’t know which parts”.

[–] [email protected] 10 points 1 year ago

Health checks are the only reason I've used 204 no content responses, so there's that too.