From c0d67d0a3d4a347a00f9ba03c6d4255805651534 Mon Sep 17 00:00:00 2001 From: Henry Robinson Date: Fri, 12 Apr 2024 11:42:27 +0100 Subject: [PATCH] Make -grpc_prometheus work when not using a grpc server Signed-off-by: Henry Robinson --- go/vt/servenv/grpc_server.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/go/vt/servenv/grpc_server.go b/go/vt/servenv/grpc_server.go index 96fe3c25ea9..c175db7b28b 100644 --- a/go/vt/servenv/grpc_server.go +++ b/go/vt/servenv/grpc_server.go @@ -273,15 +273,16 @@ func interceptors() []grpc.ServerOption { } func serveGRPC() { - if grpccommon.EnableGRPCPrometheus() { - grpc_prometheus.Register(GRPCServer) - grpc_prometheus.EnableHandlingTimeHistogram() - } // skip if not registered if gRPCPort == 0 { return } + if grpccommon.EnableGRPCPrometheus { + grpc_prometheus.Register(GRPCServer) + grpc_prometheus.EnableHandlingTimeHistogram() + } + // register reflection to support list calls :) reflection.Register(GRPCServer)