Skip to content

Commit

Permalink
feat: add health check server (#589)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevmo314 authored Oct 26, 2021
1 parent e42ee58 commit 09707c7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cmd/signal/allrpc/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import (
"github.com/pion/ion-sfu/pkg/sfu"
"github.com/prometheus/client_golang/prometheus/promhttp"
"google.golang.org/grpc"
"google.golang.org/grpc/health"
"google.golang.org/grpc/health/grpc_health_v1"

// pprof
_ "net/http/pprof"
Expand Down Expand Up @@ -51,6 +53,7 @@ func (s *Server) ServeGRPC(gaddr string) error {
grpc.StreamInterceptor(grpc_prometheus.StreamServerInterceptor),
)
pb.RegisterSFUServer(gs, grpcServer.NewServer(s.sfu))
grpc_health_v1.RegisterHealthServer(gs, health.NewServer())
s.logger.Info("GRPC Listening", "addr", gaddr)

if err := gs.Serve(l); err != nil {
Expand Down
3 changes: 3 additions & 0 deletions cmd/signal/grpc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import (
"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/spf13/viper"
"google.golang.org/grpc"
"google.golang.org/grpc/health"
"google.golang.org/grpc/health/grpc_health_v1"
)

type grpcConfig struct {
Expand Down Expand Up @@ -188,6 +190,7 @@ func main() {
dc.Use(datachannel.SubscriberAPI)

pb.RegisterSFUServer(s, server.NewServer(nsfu))
grpc_health_v1.RegisterHealthServer(s, health.NewServer())
grpc_prometheus.Register(s)

go startMetrics(metricsAddr)
Expand Down

0 comments on commit 09707c7

Please sign in to comment.