-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Add a proper / minimal health check endpoint #1933
Comments
Hm, so Kubernetes doesn't do HEAD requests kubernetes/kubernetes#49937 (don't see any strong objections in the issue, maybe they could add the capability)
Can you add headers for GET requests on Kubernetes? Another option might be supporting a special header at the root (Related: #1891) |
Thanks for the quick response!! Ahh nice - I had missed the Yes, a header would be possible as well (I am already using this since my health check is not in my default schema 😉 ) - headers are configurable with something like this:
|
Cool. Then we'd need to find a suitable header for this. It could a custom media type like the one we use for a single json object - We could also take advantage of this header to do #1526. |
What about using |
Fully agree. That would solve the issue and also be consistent with what we have now. |
Another thing about using So this minimal root endpoint should execute a simpler query like |
There was an idea on #1526 (comment) about using a second port.
So we could have a GET localhost:3001/healthy This would also let us have a consistent interface for metrics(#1526) @wolfgangwalther @colearendt WDYT? |
How would that work with unix sockets? Maybe we can just make it a Disabled by default, thereby no breaking change and we don't hardcode any endpoint that will then be blocked for regular use. |
Hm, I guess the same - one extra unix socket for the management api, i.e. a config like
This seems simpler though.
Instead of nested routes, maybe they could use query strings, like One downside of the |
Maybe this doesn't matter in this case though, if you can hit the admin unix socket you might as well do a (Down the road, we might get requests to implement these sort of endpoints - reload, quit, ..) |
I do like the second port approach, and find that to be consistent with what other services offer, especially with prometheus metrics, etc. Most health-check libraries (Kubernetes, Prometheus, etc.) do not have great support for authentication (or run in a non-interactive context where authentication is challenging), so having the endpoint be unauthenticated is ideal. Ensuring that the health check is actually tied to the health of the other service / database connection is key too. I have seen applications where the "main" service goes down, but the health check stays up / happy 🙈 😢 |
There's now proper health check endpoints on the latest pre-release: https://github.com/PostgREST/postgrest/releases/tag/v9.0.0.20220107 |
Environment
Description of issue
Related to #1565
When running Postgrest in Kubernetes (I have been toying around with a helm chart), there is not the option to use a
HEAD
request as suggested #1565 . Further, my own personal/rpc/health_check
endpoint requires a round-trip to the database. It would be nice if postgrest had its own configurable health endpoint (if the path is configurable, then you do not have to worry about conflicts with user-defined tables/functions).This is particularly useful when the schema generated by postgrest (and thus the response at
/
) is large, and we want health checks to be minimal as far as overhead / responsiveness is concerned. This is the case for readiness probes in Kubernetes.My current health check implementation, which uses an
/rpc
to return a simple{}
and HTTP 200.The text was updated successfully, but these errors were encountered: