Skip to main content

# Health checks

Health checks are exposed by an app as a gRPC service. They are typically used with an external monitoring service to check the status of an app. The service can be configured for various real-time monitoring scenarios:

- Health probes can be used by container orchestrators and load balancers to check an app's status. For example, Kubernetes supports gRPC liveness, readiness and startup probes. Kubernetes can be configured to reroute traffic or restart unhealthy containers based on gRPC health check results.
- Use of memory, disk, and other physical server resources can be monitored for healthy status. Health checks can test an app's dependencies, such as databases and external service endpoints, to confirm availability and normal functioning.

gRPC ASP.NET Core has built-in support for gRPC health checks with the `Grpc.AspNetCore.HealthChecks`

# Configuring healthChecks

- Add a `Grpc.AspNetCore.HealthCheck`s package reference.
- Register gRPC health checks service:
  - `AddGrpcHealthChecks` to register services that enable health checks.
  - `MapGrpcHealthChecksService` to add a health checks service endpoint.

https://github.com/grpc/grpc/blob/master/doc/health-checking.md

https://learn.microsoft.com/en-us/aspnet/core/grpc/health-checks?view=aspnetcore-7.0

https://learn.microsoft.com/en-us/aspnet/core/grpc/health-checks?view=aspnetcore-7.0

https://github.com/open-telemetry/opentelemetry-dotnet/blob/main/src/OpenTelemetry.Instrumentation.GrpcNetClient/README.md