contribsys / faktory

Language-agnostic persistent background job server
https://contribsys.com/faktory/
Other
5.73k stars 227 forks source link

Add healthcheck endpoint to web that returns 200 status #381

Closed profsmallpine closed 2 years ago

profsmallpine commented 2 years ago

I am wondering if anybody else has this need to get past the health check on a load balancer. If the web UI has a password setup, would it be possible to have an unauthenticated endpoint at /healthcheck or w/e?

mperham commented 2 years ago

Seems legit to me. 👍🏻

mperham commented 2 years ago

I could open up the /stats endpoint but that does a fair amount of work in Redis to gather all the data. I could build a simpler set of health oriented stats. Anyone have any thoughts on what elements to include, with the understanding that this data is open to the world?

mperham commented 2 years ago

Or is “200 OK” sufficient and I’m overthinking this?

profsmallpine commented 2 years ago

I can't think of any diagnostic data that is relevant here. This is basically just looking to see that "yep, you're alive little web process, nice job". So yeah, "200 OK" is sufficient. I'd opt for opening things up if they are needed in the future as opposed to dropping stats to the world since its there.

mperham commented 2 years ago

I added a few metrics that I think would be useful for a basic monitoring Dashboard.

Notably the /health endpoint does NOT hit Redis for efficiency reasons and to avoid a possible vector for DDOS.

mperham commented 2 years ago
❯ curl -qq http://localhost:7420/health | jq
{
  "now": "2021-10-01T17:21:24.864463Z",
  "server": {
    "command_count": 0,
    "connections": 0,
    "description": "Faktory",
    "faktory_version": "1.5.4"
  }
}