Health Check#

Just like each individual Executors, the Gateway also exposes a health check endpoint.

In contrast to Executors however, a Gateway can use gRPC, HTTP, or WebSocketss, and the health check endpoint changes accordingly.

Using gRPC#

When using gRPC as the protocol to communicate with the Gateway, the Gateway uses the exact same mechanism as Executors to expose its health status: It exposes the standard gRPC health check to the outside world.

With the same Flow as before, you can use the same way to check the Gateway status:

docker run --network='host' fullstorydev/grpcurl -plaintext 127.0.0.1:12345 grpc.health.v1.Health/Check
{
  "status": "SERVING"
}

Using HTTP or WebSockets#

Caution

For Gateways running with HTTP or WebSockets, the gRPC health check response codes outlined above do not apply.

Instead, an error free response signifies healthiness.

When using HTTP or WebSockets as the Gateway protocol, you can query the endpoint '/' to check the status.

First, create a Flow with HTTP or WebSockets protocol:

from jina import Flow

f = Flow(protocol='http', port=12345).add()
with f:
    f.block()

Then query the “empty” endpoint:

curl http://localhost:12345

You get a valid empty response indicating the Gateway’s ability to serve:

{}