Health Check Endpoints
This page is currently under construction and expected to change. Please feel free to reach out to us directly in case you are having any troubles.
GraphQL Mesh is aware of the usefulness of a health check and gives the user maximum possibilities to use the built-in check.
Types of health checks
There are two types of health checks: liveliness and readiness, they both are a health check but convey a different meaning:
- Liveliness checks whether the service is alive and running
- Readiness checks whether the upstream services are ready to perform work
The difference is that a service can be live but not ready - for example, server has started and is accepting requests (alive), but the read replica it uses is still unavailable (not ready).
Liveliness
By default, you can check whether Mesh is alive by issuing a request to the /healthcheck
endpoint
and expecting the response 200 OK
.
Of course, you can change this endpoint through the healthCheckEndpoint
option.
import { defineConfig } from '@graphql-mesh/serve-cli'
export const serveConfig = defineConfig({
healthCheckEndpoint: '/healthcheck'
})
A successful response is just 200 OK
without a body.
Readiness
Additionally, we have another endpoint which checks whether the services powering Mesh are ready to perform work.
import { defineConfig } from '@graphql-mesh/serve-cli'
export const serveConfig = defineConfig({
readinessCheckEndpoint: '/readiness'
})
It returns 200 OK
if all the services are ready to perform work.