kaskada.health.health_check_servicer

Module Contents

Classes

HealthCheckServicer

An aggregate health check servicer designed to monitor the health of multiple gRPC services by managing multiple HealthCheckClients.

Attributes

logger

logger[source]
class HealthCheckServicer(client_factory=HealthCheckClientFactory())[source]

An aggregate health check servicer designed to monitor the health of multiple gRPC services by managing multiple HealthCheckClients.

The underlying implementation uses thread mutex locks to ensure safe updating/reading of health service state.

Parameters:

client_factory (kaskada.health.health_check_client.HealthCheckClientFactory) –

add_service(service_name, health_check_endpoint, is_secure)[source]

Adds a gRPC service to monitor.

Parameters:
  • service_name (str) – the name of the service

  • health_check_endpoint (str) – the service’s health check endpoint

  • is_secure (bool) – True to use SSL or False to use an insecure connection

check()[source]

Checks the status of all services managed by the servicer.

Returns:

SERVING if all are ready, otherwise a non-ready status

Return type:

health_pb2.HealthCheckResponse.ServingStatus

get(service_name=None)[source]

Gets the overall status of the servicer or of a specific service. This method pulls from a thread-safe cache rather than performing the actual health check. To get the service status, call the check() method.

Parameters:

service_name (Optional[str], optional) – service to return the status. None will aggregate the status Defaults to None.

Returns:

SERVING if all services are reporting ready, otherwise a non-ready status

Return type:

health_pb2.HealthCheckResponse.ServingStatus