From 759f84661c14e2483d2202daf4d96392d51ac86f Mon Sep 17 00:00:00 2001 From: jaime Date: Wed, 25 Dec 2024 16:37:35 +0800 Subject: [PATCH] fix: Revert Expose metrics of stanby coordinators (#27698) This reverts commit e3f21226189e8e98b5620ad293788c982e80192b. --- internal/datacoord/services.go | 2 +- internal/querycoordv2/services.go | 2 +- internal/rootcoord/root_coord.go | 2 +- pkg/util/merr/utils.go | 12 ------------ 4 files changed, 3 insertions(+), 15 deletions(-) diff --git a/internal/datacoord/services.go b/internal/datacoord/services.go index 91a254c9de3d9..16e8098268092 100644 --- a/internal/datacoord/services.go +++ b/internal/datacoord/services.go @@ -1015,7 +1015,7 @@ func (s *Server) ShowConfigurations(ctx context.Context, req *internalpb.ShowCon // it may include SystemMetrics, Topology metrics, etc. func (s *Server) GetMetrics(ctx context.Context, req *milvuspb.GetMetricsRequest) (*milvuspb.GetMetricsResponse, error) { log := log.Ctx(ctx) - if err := merr.CheckHealthyStandby(s.GetStateCode()); err != nil { + if err := merr.CheckHealthy(s.GetStateCode()); err != nil { return &milvuspb.GetMetricsResponse{ Status: merr.Status(err), }, nil diff --git a/internal/querycoordv2/services.go b/internal/querycoordv2/services.go index deedd75e939f5..c1bde68331e23 100644 --- a/internal/querycoordv2/services.go +++ b/internal/querycoordv2/services.go @@ -838,7 +838,7 @@ func (s *Server) GetMetrics(ctx context.Context, req *milvuspb.GetMetricsRequest log.RatedDebug(60, "get metrics request received", zap.String("metricType", req.GetRequest())) - if err := merr.CheckHealthyStandby(s.State()); err != nil { + if err := merr.CheckHealthy(s.State()); err != nil { msg := "failed to get metrics" log.Warn(msg, zap.Error(err)) return &milvuspb.GetMetricsResponse{ diff --git a/internal/rootcoord/root_coord.go b/internal/rootcoord/root_coord.go index 6456d481f7109..8ebba1448a6dc 100644 --- a/internal/rootcoord/root_coord.go +++ b/internal/rootcoord/root_coord.go @@ -1770,7 +1770,7 @@ func (c *Core) ShowConfigurations(ctx context.Context, req *internalpb.ShowConfi // GetMetrics get metrics func (c *Core) GetMetrics(ctx context.Context, in *milvuspb.GetMetricsRequest) (*milvuspb.GetMetricsResponse, error) { - if err := merr.CheckHealthyStandby(c.GetStateCode()); err != nil { + if err := merr.CheckHealthy(c.GetStateCode()); err != nil { return &milvuspb.GetMetricsResponse{ Status: merr.Status(err), Response: "", diff --git a/pkg/util/merr/utils.go b/pkg/util/merr/utils.go index f7954d0d856d6..295153e229b0c 100644 --- a/pkg/util/merr/utils.go +++ b/pkg/util/merr/utils.go @@ -273,18 +273,6 @@ func CheckHealthy(state commonpb.StateCode) error { return nil } -// CheckHealthyStandby checks whether the state is healthy or standby, -// returns nil if healthy or standby -// otherwise returns ErrServiceNotReady wrapped with current state -// this method only used in GetMetrics -func CheckHealthyStandby(state commonpb.StateCode) error { - if state != commonpb.StateCode_Healthy && state != commonpb.StateCode_StandBy { - return WrapErrServiceNotReady(paramtable.GetRole(), paramtable.GetNodeID(), state.String()) - } - - return nil -} - func IsHealthy(stateCode commonpb.StateCode) error { if stateCode == commonpb.StateCode_Healthy { return nil