For a self-hosted installation, what does the foll...
# ask-community
a
For a self-hosted installation, what does the following health check APIs do? Is any API also checking a flow execution and its success? <http:///api/health|/api/health> /api/ready /api/hello
c
Hi Akhil! There is one main healthcheck endpoint:
/api/health
and it's used by the Prefect client to detect whether the Prefect server is up and running. You can also use this as a K8s (or other container runtime) readiness or liveness probe. The
/ready
endpoint is a little different, and it tests that the configured database is available. You can use this in your own healthchecks as well, if you choose.
a
Thx @Chris Guidry for the response. /api/health only checks if server is running on a port or does it do some deep health checks? /api/ready - is this just checking database connection or is it also making some dummy query to the DB and validating? /api/hello - what does this do? Is this running a simple hello flow in Prefect ?
c
/api/health
is very shallow and just returns `true` in JSON with a 200 status code, which can be a health/readiness probe for container runtimes and load balancers
/api/ready
makes a database connection, but doesn't actually execute a query
/api/hello
is similar in spirit to
/api/health
, just with a little more mirth:
Copy code
@router.get("/hello")
async def hello():
    """Say hello!"""
    return "👋"
It can also work as a health/readiness probe for container runtimes and load balancers
Are you looking for a way to query the last run of a flow to see if it succeeded? Perhaps our Read Flow Runs endpoint may be what you're looking for? This has a lot of query options but you can ask for the most recent run of a flow by filtering on the flow's name or ID, sorting on
END_TIME_DESC
and setting
limit
to
1
a
I was looking for a deep health check that can also validate a flow execution as well. I thought hello endpoint was probably doing that only. No issues, I can define a small flow myself and do that. Thanks for help!
c
Yep that sounds like the best strategy, as the Prefect server isn't really equipped to run flows itself