Add status for GetVersionResponse and CheckHealthResponse (#19895)

Signed-off-by: yun.zhang <yun.zhang@zilliz.com>

Signed-off-by: yun.zhang <yun.zhang@zilliz.com>
This commit is contained in:
jaime 2022-10-20 19:47:33 +08:00 committed by GitHub
parent e8cf049392
commit cf1491e41a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 7 deletions

2
go.mod
View File

@ -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

4
go.sum
View File

@ -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=

View File

@ -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
}

View File

@ -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
}