Skip to content

Commit eecef92

Browse files
committed
[core] Add basic grpc health check to core and Apricot
1 parent 8554551 commit eecef92

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

apricot/remote/server.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ import (
3737
"github.com/spf13/viper"
3838
"google.golang.org/grpc"
3939
"google.golang.org/grpc/codes"
40+
"google.golang.org/grpc/health"
41+
"google.golang.org/grpc/health/grpc_health_v1"
4042
"google.golang.org/grpc/reflection"
4143
"google.golang.org/grpc/status"
4244
)
@@ -55,6 +57,7 @@ type RpcServer struct {
5557

5658
func NewServer(service configuration.Service) *grpc.Server {
5759
s := grpc.NewServer()
60+
grpc_health_v1.RegisterHealthServer(s, health.NewServer())
5861
apricotpb.RegisterApricotServer(s, &RpcServer{
5962
service: service,
6063
})

core/server.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ import (
4242
"github.com/jinzhu/copier"
4343
"github.com/spf13/viper"
4444
"google.golang.org/grpc/codes"
45+
"google.golang.org/grpc/health"
46+
"google.golang.org/grpc/health/grpc_health_v1"
4547
"google.golang.org/grpc/reflection"
4648
"google.golang.org/grpc/status"
4749

@@ -60,6 +62,7 @@ const MAX_ERROR_LENGTH = 6000 // gRPC seems to impose this limit on the status m
6062

6163
func NewServer(state *globalState) *grpc.Server {
6264
s := grpc.NewServer()
65+
grpc_health_v1.RegisterHealthServer(s, health.NewServer())
6366
pb.RegisterControlServer(s, &RpcServer{
6467
state: state,
6568
streams: newSafeStreamsMap(),

0 commit comments

Comments
 (0)