Skip to content

Commit

Permalink
Make -grpc_prometheus work when not using a grpc server
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Robinson <[email protected]>
  • Loading branch information
henryr committed Apr 12, 2024
1 parent 99b3959 commit 7989dab
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions go/vt/servenv/grpc_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,15 +219,16 @@ func interceptors() []grpc.ServerOption {
}

func serveGRPC() {
if *grpccommon.EnableGRPCPrometheus {
grpc_prometheus.Register(GRPCServer)
grpc_prometheus.EnableHandlingTimeHistogram()
}
// skip if not registered
if GRPCPort == nil || *GRPCPort == 0 {
return
}

if *grpccommon.EnableGRPCPrometheus {
grpc_prometheus.Register(GRPCServer)
grpc_prometheus.EnableHandlingTimeHistogram()
}

// register reflection to support list calls :)
reflection.Register(GRPCServer)

Expand Down

0 comments on commit 7989dab

Please sign in to comment.