#health-check #grpc #wrapper

grpcio-health

Health check wrappers for grpcio

8 releases (5 breaking)

0.13.0 Aug 25, 2023
0.12.1 Feb 14, 2023
0.12.0 Nov 4, 2022
0.11.0 Sep 14, 2022
0.8.0 Mar 16, 2021

#4 in #healthcheck

Download history 313/week @ 2023-12-01 257/week @ 2023-12-08 277/week @ 2023-12-15 290/week @ 2023-12-22 207/week @ 2023-12-29 554/week @ 2024-01-05 539/week @ 2024-01-12 469/week @ 2024-01-19 400/week @ 2024-01-26 336/week @ 2024-02-02 71/week @ 2024-02-09 454/week @ 2024-02-16 261/week @ 2024-02-23 169/week @ 2024-03-01 134/week @ 2024-03-08 164/week @ 2024-03-15

791 downloads per month
Used in mmdb-grpc

Apache-2.0

295KB
6.5K 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

~26–35MB
~579K SLoC