Reputation: 3
I'm trying to add a gRPC health check endpoint in tensorflow serving. I added these code into tensorflow_serving/model_servers/server.cc and re-compiled it:
::grpc::EnableDefaultHealthCheckService(true);
::grpc::reflection::InitProtoReflectionServerBuilderPlugin();
After that I run it and test with grpcurl: grpcurl -plaintext localhost:8500 list
It shows:
grpc.health.v1.Health
grpc.reflection.v1alpha.ServerReflection
tensorflow.ProfilerService
tensorflow.serving.ModelService
tensorflow.serving.PredictionService
But when I try grpcurl -plaintext localhost:8500 grpc.health.v1.Health/Check
It says:
Error invoking method "grpc.health.v1.Health/Check": target server does not expose service "grpc.health.v1.Health"
It's quite a simple feature but have been stucking me for several days. Could someone help? Thanks in advance!
Upvotes: 0
Views: 947
Reputation: 219
Simply speaking, grpcurl relies on reflection service if you don't provide proto files and gRPC C++ doesn't expose reflection data for health service, which is why you got this head-scratching error in the first place.
$ grpcurl -plaintext 0.0.0.0:50051 grpc.health.v1.Health/Check
Error invoking method "grpc.health.v1.Health/Check": target server does not expose service "grpc.health.v1.Health"
grpcurl can do health-check call with health proto file present;
$ grpcurl -plaintext -proto=src/proto/grpc/health/v1/health.proto 0.0.0.0:50051 grpc.health.v1.Health/Check
{
"status": "SERVING"
}
Implementation-wise, gRPC C++ relies on protobuf description pool to implement its reflection service but health is based on upb which is not part of protobuf description pool. This is why gRPC C++ isn't able to expose the schema of health service.
Upvotes: 2