From 5afd0c0a2bf80f986131eb34bd81fcd10794bc06 Mon Sep 17 00:00:00 2001 From: jaime Date: Mon, 23 Dec 2024 11:46:57 +0800 Subject: [PATCH] fix: Revert "Expose metrics of stanby coordinators (#27698)" (#38620) issue: #38608 Signed-off-by: jaime --- 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 19969477aaae5..0c3b776ef5094 100644 --- a/internal/datacoord/services.go +++ b/internal/datacoord/services.go @@ -1093,7 +1093,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 { msg := "failed to get metrics" log.Warn(msg, zap.Error(err)) return &milvuspb.GetMetricsResponse{ diff --git a/internal/querycoordv2/services.go b/internal/querycoordv2/services.go index 69e3d8d1c56a3..d8aa5178711a4 100644 --- a/internal/querycoordv2/services.go +++ b/internal/querycoordv2/services.go @@ -832,7 +832,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 8f13b6496ef9e..914b0cee142e8 100644 --- a/internal/rootcoord/root_coord.go +++ b/internal/rootcoord/root_coord.go @@ -1866,7 +1866,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 d29df8199fc69..1515dbd56ce7b 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