Skip to content

Commit

Permalink
[core] Add basic grpc health check to core and Apricot
Browse files Browse the repository at this point in the history
  • Loading branch information
teo committed Jul 19, 2023
1 parent 8554551 commit eecef92
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions apricot/remote/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ import (
"github.com/spf13/viper"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/health"
"google.golang.org/grpc/health/grpc_health_v1"
"google.golang.org/grpc/reflection"
"google.golang.org/grpc/status"
)
Expand All @@ -55,6 +57,7 @@ type RpcServer struct {

func NewServer(service configuration.Service) *grpc.Server {
s := grpc.NewServer()
grpc_health_v1.RegisterHealthServer(s, health.NewServer())
apricotpb.RegisterApricotServer(s, &RpcServer{
service: service,
})
Expand Down
3 changes: 3 additions & 0 deletions core/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ import (
"github.com/jinzhu/copier"
"github.com/spf13/viper"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/health"
"google.golang.org/grpc/health/grpc_health_v1"
"google.golang.org/grpc/reflection"
"google.golang.org/grpc/status"

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

func NewServer(state *globalState) *grpc.Server {
s := grpc.NewServer()
grpc_health_v1.RegisterHealthServer(s, health.NewServer())
pb.RegisterControlServer(s, &RpcServer{
state: state,
streams: newSafeStreamsMap(),
Expand Down

0 comments on commit eecef92

Please sign in to comment.