From cf1491e41a88ae4856ae944b250f6610e62e8d1b Mon Sep 17 00:00:00 2001 From: jaime Date: Thu, 20 Oct 2022 19:47:33 +0800 Subject: [PATCH] Add status for GetVersionResponse and CheckHealthResponse (#19895) Signed-off-by: yun.zhang Signed-off-by: yun.zhang --- go.mod | 2 +- go.sum | 4 ++-- internal/distributed/proxy/service.go | 4 ++++ internal/proxy/impl.go | 17 +++++++++++++---- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index 720aa947cd..3555ba6856 100644 --- a/go.mod +++ b/go.mod @@ -29,7 +29,7 @@ require ( github.com/klauspost/compress v1.14.2 github.com/lingdor/stackerror v0.0.0-20191119040541-976d8885ed76 github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d - github.com/milvus-io/milvus-proto/go-api v0.0.0-20221017091121-7a703d4485b5 + github.com/milvus-io/milvus-proto/go-api v0.0.0-20221019080323-84e9fa2f9e45 github.com/minio/minio-go/v7 v7.0.17 github.com/opentracing/opentracing-go v1.2.0 github.com/panjf2000/ants/v2 v2.4.8 diff --git a/go.sum b/go.sum index a3a857e831..f5f1d15a9f 100644 --- a/go.sum +++ b/go.sum @@ -493,8 +493,8 @@ github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d/go.mod h1:01TrycV0kFyex github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/milvus-io/gorocksdb v0.0.0-20220624081344-8c5f4212846b h1:TfeY0NxYxZzUfIfYe5qYDBzt4ZYRqzUjTR6CvUzjat8= github.com/milvus-io/gorocksdb v0.0.0-20220624081344-8c5f4212846b/go.mod h1:iwW+9cWfIzzDseEBCCeDSN5SD16Tidvy8cwQ7ZY8Qj4= -github.com/milvus-io/milvus-proto/go-api v0.0.0-20221017091121-7a703d4485b5 h1:CDEQi9T8A7YEtQwHXEBXTl/PDXLzzJSRral8TM+1Krk= -github.com/milvus-io/milvus-proto/go-api v0.0.0-20221017091121-7a703d4485b5/go.mod h1:148qnlmZ0Fdm1Fq+Mj/OW2uDoEP25g3mjh0vMGtkgmk= +github.com/milvus-io/milvus-proto/go-api v0.0.0-20221019080323-84e9fa2f9e45 h1:QxGQqRtJbbdMf/jxodjYaTW8ZcqdyPDsuhIb9Y2jnwk= +github.com/milvus-io/milvus-proto/go-api v0.0.0-20221019080323-84e9fa2f9e45/go.mod h1:148qnlmZ0Fdm1Fq+Mj/OW2uDoEP25g3mjh0vMGtkgmk= github.com/milvus-io/pulsar-client-go v0.6.8 h1:fZdZH73aPRszu2fazyeeahQEz34tyn1Pt9EkqJmV100= github.com/milvus-io/pulsar-client-go v0.6.8/go.mod h1:oFIlYIk23tamkSLttw849qphmMIpHY8ztEBWDWJW+sc= github.com/minio/asm2plan9s v0.0.0-20200509001527-cdd76441f9d8 h1:AMFGa4R4MiIpspGNG7Z948v4n35fFGB3RR3G/ry4FWs= diff --git a/internal/distributed/proxy/service.go b/internal/distributed/proxy/service.go index 16e6c6c4f0..049d388199 100644 --- a/internal/distributed/proxy/service.go +++ b/internal/distributed/proxy/service.go @@ -879,6 +879,10 @@ func (s *Server) GetProxyMetrics(ctx context.Context, request *milvuspb.GetMetri func (s *Server) GetVersion(ctx context.Context, request *milvuspb.GetVersionRequest) (*milvuspb.GetVersionResponse, error) { buildTags := os.Getenv(metricsinfo.GitBuildTagsEnvKey) return &milvuspb.GetVersionResponse{ + Status: &commonpb.Status{ + ErrorCode: commonpb.ErrorCode_Success, + Reason: "", + }, Version: buildTags, }, nil } diff --git a/internal/proxy/impl.go b/internal/proxy/impl.go index 405d244bff..e7bade8b49 100644 --- a/internal/proxy/impl.go +++ b/internal/proxy/impl.go @@ -4585,7 +4585,10 @@ func (node *Proxy) SetRates(ctx context.Context, request *proxypb.SetRatesReques func (node *Proxy) CheckHealth(ctx context.Context, request *milvuspb.CheckHealthRequest) (*milvuspb.CheckHealthResponse, error) { if !node.checkHealthy() { reason := errorutil.UnHealthReason("proxy", node.session.ServerID, "proxy is unhealthy") - return &milvuspb.CheckHealthResponse{IsHealthy: false, Reasons: []string{reason}}, nil + return &milvuspb.CheckHealthResponse{ + Status: unhealthyStatus(), + IsHealthy: false, + Reasons: []string{reason}}, nil } group, ctx := errgroup.WithContext(ctx) @@ -4597,13 +4600,13 @@ func (node *Proxy) CheckHealth(ctx context.Context, request *milvuspb.CheckHealt defer mu.Unlock() if err != nil { - log.Warn("check health fail,", zap.String("role", role), zap.Error(err)) + log.Warn("check health fail", zap.String("role", role), zap.Error(err)) errReasons = append(errReasons, fmt.Sprintf("check health fail for %s", role)) return err } if !resp.IsHealthy { - log.Warn("check health fail,", zap.String("role", role)) + log.Warn("check health fail", zap.String("role", role)) errReasons = append(errReasons, resp.Reasons...) } return nil @@ -4637,5 +4640,11 @@ func (node *Proxy) CheckHealth(ctx context.Context, request *milvuspb.CheckHealt }, nil } - return &milvuspb.CheckHealthResponse{IsHealthy: true}, nil + return &milvuspb.CheckHealthResponse{ + Status: &commonpb.Status{ + ErrorCode: commonpb.ErrorCode_Success, + Reason: "", + }, + IsHealthy: true, + }, nil }