class GRPCHealthIndicator {
getHealthService(service: string, settings: CheckGRPCServiceOptions<GrpcClientOptionsLike>)
checkService<GrpcOptions extends GrpcClientOptionsLike = GrpcClientOptionsLike, Key extends string = string>(key: Key, service: string, options: CheckGRPCServiceOptions<GrpcOptions> = {}): Promise<HealthIndicatorResult<Key>>
}
Methods
getHealthService()
|
getHealthService(service: string, settings: CheckGRPCServiceOptions<GrpcClientOptionsLike>)
Parameters
|
checkService()
|
Checks if the given service is up using the standard health check
specification of GRPC.
|
checkService<GrpcOptions extends GrpcClientOptionsLike = GrpcClientOptionsLike, Key extends string = string>(key: Key, service: string, options: CheckGRPCServiceOptions<GrpcOptions> = {}): Promise<HealthIndicatorResult<Key>>
Parameters
Option |
Type |
Description |
key
|
string |
The key which will be used for the result object
|
service
|
string |
The service which should be checked
|
options
|
CheckGRPCOptions |
Configuration for the request
Optional. Default is `{}`.
|
Examples
grpc.checkService('hero_service', 'hero.health.v1')
grpc.checkService('hero_service', 'hero.health.v1', { timeout: 300 })
grpc.checkService('hero_service', 'hero.health.v1', {
timeout: 500,
package: 'grpc.health.v2',
protoPath: join(__dirname, './protos/my-custom-health.v1'),
healthServiceName: 'Health',
healthServiceCheck: (healthService: any, service: string) =>
healthService.check({ service }).toPromise(),
})
Returns
Promise<HealthIndicatorResult<Key>>
Throws
HealthCheckError Gets thrown in case a health check failed
TimeoutError Gets thrown in case a health check exceeded the given timeout
UnhealthyResponseCodeError Gets thrown in case the received response is unhealthy
|
https://github.com/grpc/grpc/blob/master/doc/health-checking.md
|