Performing health checks

This page applies to Apigee and Apigee hybrid.

View Apigee Edge documentation.

Apigee exposes health checks at different levels, which you can leverage depending upon the use case.

  1. Regional-level / Apigee instance health check: Returns the health of overall Apigee instance in a region.
  2. Environment-level health checks: Returns the health of a particular environment in the Apigee instance.
  3. Custom health check through an API proxy: For complex use cases, you can configure a dedicated API proxy as a custom health check endpoint.

Performing a regional-level health check

Apigee offers a regional-level / Apigee instance health check to assess the overall health status of the Apigee instance in a specific region. This health check pattern, widely used by load balancers, determines the health status of Apigee instances and performs regional failovers. You can perform a regional-level health check by constructing the request as follows:

  • Health check path: /healthz/ingress
  • Add request header: User-Agent: GoogleHC.
$ curl -H 'User-Agent: GoogleHC' https://$HOST/healthz/ingress
Apigee Ingress is healthy
where, $HOST represents the host name defined in the Apigee environment group that is served by the load balancer.

Performing a environment-level health check

Apigee offers an environment-level health check to assess the health of a particular environment served by the Apigee instance. This health check pattern is preferred when you want to perform regional failovers based on the health of certain critical/selective environments. You can perform an environment-level health check by calling any valid API proxy in an environment by constructing the request as follows:

  • Prepend /healthz/ to the proxy basepath.
  • Add request header: User-Agent: GoogleHC.

For example, assume that /catalog is a valid proxy basepath that is deployed in an environment. To do a health check, call the proxy like this:

$ curl -H 'User-Agent: GoogleHC' https://$HOST/healthz/catalog
Server Ready
where, $HOST represents the host name defined in the Apigee environment group that is served by the load balancer.

Performing a custom health check through an API proxy

If you want to perform any additional validations, you can define custom health check logic in an API proxy deployed to an environment. For example, you might fail the healthcheck when multiple environments are down. Or, you could fail the healthcheck based on target health or latency.

In this case, you can perform the health check by making a regular API call to that proxy.

For example, assume that you want to check the health of an environment called prod. Deploy an API proxy to that environment with the basepath /healthcheck-prod. To check the health of the prod environment served by Apigee instance, call the proxy like this:

$ curl https://$HOST/healthcheck-prod
where, $HOST represents the host name defined in the Apigee environment group that is served by the load balancer.

Usage notes

For regional-level and environment-level healthchecks: If they are performed by the Google Cloud load balancers, the load balancer sets the correct User-Agent header. If your own client consumes these health check API calls, you need to make sure the correct User-Agent is set.

For Apigee hybrid: The health check feature is only available for version 1.4 and higher.