#grpc #healthcheck

grpcio-health

Health check wrappers for grpcio

2 unstable releases

0.9.0 May 24, 2021
0.8.0 Mar 16, 2021

#706 in Network programming

Download history 349/week @ 2021-07-04 340/week @ 2021-07-11 356/week @ 2021-07-18 328/week @ 2021-07-25 383/week @ 2021-08-01 390/week @ 2021-08-08 368/week @ 2021-08-15 378/week @ 2021-08-22 372/week @ 2021-08-29 471/week @ 2021-09-05 492/week @ 2021-09-12 398/week @ 2021-09-19 377/week @ 2021-09-26 410/week @ 2021-10-03 496/week @ 2021-10-10 481/week @ 2021-10-17

771 downloads per month

Apache-2.0

255KB
6K SLoC

grpcio-healthcheck

Crates.io docs.rs

grpcio-health provides health check protos as well as some helper structs to make health check easily.


lib.rs:

grpcio-health provides health check protos as well as some helper structs to make health check easily. For the detail design of health checking service, see https://github.com/grpc/grpc/blob/master/doc/health-checking.md.

Usage

The crate provides a default implementation of Health service, you can use it to maintain the service states. First, you need to register it to the server builder so that it can serve health check service later.

use grpcio_health::{HealthService, create_health};

let service = HealthService::default();
let builder = builder.register_service(create_health(service.clone()));

Then insert service status for query.

service.set_serving_status("", ServingStatus::Serving);

"" means overall health status. You can also provide specific service name.

Client can either use check to do one time query or watch to observe status changes.

use grpcio_health::proto::HealthCheckRequest;

let client = HealthClient::new(ch);
let req = HealthCheckRequest { service: "".to_string(), ..Default::default() };
let status_resp = client.check_async(&req).await.unwrap();
assert_eq!(statuss_resp.status, ServingStatus::Serving);

Dependencies

~23MB
~496K SLoC