Expose metrics of root coordinator (#7228)

Signed-off-by: dragondriver <jiquan.long@zilliz.com>
pull/7380/head
dragondriver 2021-08-31 11:45:59 +08:00 committed by GitHub
parent 8f660ae4e6
commit f0dbdd7f13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 404 additions and 49 deletions

View File

@ -326,3 +326,10 @@ func (c *GrpcClient) SegmentFlushCompleted(ctx context.Context, in *datapb.Segme
})
return ret.(*commonpb.Status), err
}
func (c *GrpcClient) GetMetrics(ctx context.Context, in *milvuspb.GetMetricsRequest) (*milvuspb.GetMetricsResponse, error) {
ret, err := c.recall(func() (interface{}, error) {
return c.grpcClient.GetMetrics(ctx, in)
})
return ret.(*milvuspb.GetMetricsResponse), err
}

View File

@ -352,3 +352,7 @@ func (s *Server) ReleaseDQLMessageStream(ctx context.Context, in *proxypb.Releas
func (s *Server) SegmentFlushCompleted(ctx context.Context, in *datapb.SegmentFlushCompletedMsg) (*commonpb.Status, error) {
return s.rootCoord.SegmentFlushCompleted(ctx, in)
}
func (s *Server) GetMetrics(ctx context.Context, in *milvuspb.GetMetricsRequest) (*milvuspb.GetMetricsResponse, error) {
return s.rootCoord.GetMetrics(ctx, in)
}

View File

@ -98,6 +98,9 @@ service RootCoord {
rpc UpdateChannelTimeTick(internal.ChannelTimeTickMsg) returns (common.Status) {}
rpc ReleaseDQLMessageStream(proxy.ReleaseDQLMessageStreamRequest) returns (common.Status) {}
rpc SegmentFlushCompleted(data.SegmentFlushCompletedMsg) returns (common.Status) {}
// https://wiki.lfaidata.foundation/display/MIL/MEP+8+--+Add+metrics+for+proxy
rpc GetMetrics(milvus.GetMetricsRequest) returns (milvus.GetMetricsResponse) {}
}
message AllocTimestampRequest {

View File

@ -243,55 +243,57 @@ func init() {
func init() { proto.RegisterFile("root_coord.proto", fileDescriptor_4513485a144f6b06) }
var fileDescriptor_4513485a144f6b06 = []byte{
// 765 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 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x49, 0xf7, 0x89, 0xa9, 0xa4, 0x92, 0x39, 0x4a,
0xea, 0x03, 0x5c, 0xa0, 0xe8, 0xa2, 0x70, 0x74, 0x8d, 0x27, 0x63, 0x09, 0x06, 0x53, 0x20, 0x23,
0x96, 0x14, 0x4e, 0xc6, 0x72, 0xfe, 0xee, 0xeb, 0xdb, 0x91, 0x2e, 0xc6, 0x93, 0x81, 0x6b, 0xdd,
0xf4, 0xc9, 0x63, 0x9d, 0x05, 0xbf, 0x9a, 0x32, 0x8d, 0xa6, 0xa7, 0xd4, 0x0c, 0x03, 0xb6, 0x07,
0x83, 0x65, 0xef, 0xd3, 0xd9, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xa8, 0x2e, 0x6c, 0xa3, 0xa7,
0x0b, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@ -374,6 +376,8 @@ type RootCoordClient interface {
UpdateChannelTimeTick(ctx context.Context, in *internalpb.ChannelTimeTickMsg, opts ...grpc.CallOption) (*commonpb.Status, error)
ReleaseDQLMessageStream(ctx context.Context, in *proxypb.ReleaseDQLMessageStreamRequest, opts ...grpc.CallOption) (*commonpb.Status, error)
SegmentFlushCompleted(ctx context.Context, in *datapb.SegmentFlushCompletedMsg, opts ...grpc.CallOption) (*commonpb.Status, error)
// https://wiki.lfaidata.foundation/display/MIL/MEP+8+--+Add+metrics+for+proxy
GetMetrics(ctx context.Context, in *milvuspb.GetMetricsRequest, opts ...grpc.CallOption) (*milvuspb.GetMetricsResponse, error)
}
type rootCoordClient struct {
@ -582,6 +586,15 @@ func (c *rootCoordClient) SegmentFlushCompleted(ctx context.Context, in *datapb.
return out, nil
}
func (c *rootCoordClient) GetMetrics(ctx context.Context, in *milvuspb.GetMetricsRequest, opts ...grpc.CallOption) (*milvuspb.GetMetricsResponse, error) {
out := new(milvuspb.GetMetricsResponse)
err := c.cc.Invoke(ctx, "/milvus.proto.rootcoord.RootCoord/GetMetrics", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// RootCoordServer is the server API for RootCoord service.
type RootCoordServer interface {
GetComponentStates(context.Context, *internalpb.GetComponentStatesRequest) (*internalpb.ComponentStates, error)
@ -652,6 +665,8 @@ type RootCoordServer interface {
UpdateChannelTimeTick(context.Context, *internalpb.ChannelTimeTickMsg) (*commonpb.Status, error)
ReleaseDQLMessageStream(context.Context, *proxypb.ReleaseDQLMessageStreamRequest) (*commonpb.Status, error)
SegmentFlushCompleted(context.Context, *datapb.SegmentFlushCompletedMsg) (*commonpb.Status, error)
// https://wiki.lfaidata.foundation/display/MIL/MEP+8+--+Add+metrics+for+proxy
GetMetrics(context.Context, *milvuspb.GetMetricsRequest) (*milvuspb.GetMetricsResponse, error)
}
// UnimplementedRootCoordServer can be embedded to have forward compatible implementations.
@ -724,6 +739,9 @@ func (*UnimplementedRootCoordServer) ReleaseDQLMessageStream(ctx context.Context
func (*UnimplementedRootCoordServer) SegmentFlushCompleted(ctx context.Context, req *datapb.SegmentFlushCompletedMsg) (*commonpb.Status, error) {
return nil, status.Errorf(codes.Unimplemented, "method SegmentFlushCompleted not implemented")
}
func (*UnimplementedRootCoordServer) GetMetrics(ctx context.Context, req *milvuspb.GetMetricsRequest) (*milvuspb.GetMetricsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetMetrics not implemented")
}
func RegisterRootCoordServer(s *grpc.Server, srv RootCoordServer) {
s.RegisterService(&_RootCoord_serviceDesc, srv)
@ -1125,6 +1143,24 @@ func _RootCoord_SegmentFlushCompleted_Handler(srv interface{}, ctx context.Conte
return interceptor(ctx, in, info, handler)
}
func _RootCoord_GetMetrics_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(milvuspb.GetMetricsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(RootCoordServer).GetMetrics(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/milvus.proto.rootcoord.RootCoord/GetMetrics",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RootCoordServer).GetMetrics(ctx, req.(*milvuspb.GetMetricsRequest))
}
return interceptor(ctx, in, info, handler)
}
var _RootCoord_serviceDesc = grpc.ServiceDesc{
ServiceName: "milvus.proto.rootcoord.RootCoord",
HandlerType: (*RootCoordServer)(nil),
@ -1217,6 +1253,10 @@ var _RootCoord_serviceDesc = grpc.ServiceDesc{
MethodName: "SegmentFlushCompleted",
Handler: _RootCoord_SegmentFlushCompleted_Handler,
},
{
MethodName: "GetMetrics",
Handler: _RootCoord_GetMetrics_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "root_coord.proto",

View File

@ -0,0 +1,27 @@
// Copyright (C) 2019-2020 Zilliz. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed under the License
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
// or implied. See the License for the specific language governing permissions and limitations under the License.
package rootcoord
import (
"errors"
"fmt"
"github.com/milvus-io/milvus/internal/util/typeutil"
)
func msgRootCoordIsUnhealthy(coordID typeutil.UniqueID) string {
return fmt.Sprintf("RootCoord %d is not ready", coordID)
}
func errRootCoordIsUnhealthy(coordID typeutil.UniqueID) error {
return errors.New(msgRootCoordIsUnhealthy(coordID))
}

View File

@ -0,0 +1,39 @@
// Copyright (C) 2019-2020 Zilliz. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed under the License
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
// or implied. See the License for the specific language governing permissions and limitations under the License.
package rootcoord
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/milvus-io/milvus/internal/util/typeutil"
"github.com/milvus-io/milvus/internal/log"
"go.uber.org/zap"
)
func TestMsgRootCoordIsUnhealthy(t *testing.T) {
nodeIDList := []typeutil.UniqueID{1, 2, 3}
for _, nodeID := range nodeIDList {
assert.NotEmpty(t, msgRootCoordIsUnhealthy(nodeID))
log.Info("TestMsgRootCoordIsUnhealthy", zap.String("msg", msgRootCoordIsUnhealthy(nodeID)))
}
}
func TestErrRootCoordIsUnhealthy(t *testing.T) {
nodeIDList := []typeutil.UniqueID{1, 2, 3}
for _, nodeID := range nodeIDList {
assert.NotNil(t, errRootCoordIsUnhealthy(nodeID))
log.Info("TestErrRootCoordIsUnhealthy", zap.Error(errRootCoordIsUnhealthy(nodeID)))
}
}

View File

@ -0,0 +1,57 @@
// Copyright (C) 2019-2020 Zilliz. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed under the License
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
// or implied. See the License for the specific language governing permissions and limitations under the License.
package rootcoord
import (
"context"
"go.uber.org/zap"
"github.com/milvus-io/milvus/internal/log"
"github.com/milvus-io/milvus/internal/proto/commonpb"
"github.com/milvus-io/milvus/internal/proto/milvuspb"
"github.com/milvus-io/milvus/internal/util/metricsinfo"
"github.com/milvus-io/milvus/internal/util/typeutil"
)
func (c *Core) getSystemInfoMetrics(ctx context.Context, req *milvuspb.GetMetricsRequest) (*milvuspb.GetMetricsResponse, error) {
// TODO(dragondriver): add more metrics
nodeInfos := metricsinfo.RootCoordInfos{
BaseComponentInfos: metricsinfo.BaseComponentInfos{
Name: metricsinfo.ConstructComponentName(typeutil.RootCoordRole, c.session.ServerID),
},
}
resp, err := metricsinfo.MarshalComponentInfos(nodeInfos)
if err != nil {
log.Warn("Failed to marshal system info metrics of root coordinator",
zap.Error(err))
return &milvuspb.GetMetricsResponse{
Status: &commonpb.Status{
ErrorCode: commonpb.ErrorCode_UnexpectedError,
Reason: err.Error(),
},
Response: "",
ComponentName: metricsinfo.ConstructComponentName(typeutil.RootCoordRole, c.session.ServerID),
}, nil
}
return &milvuspb.GetMetricsResponse{
Status: &commonpb.Status{
ErrorCode: commonpb.ErrorCode_Success,
Reason: "",
},
Response: resp,
ComponentName: metricsinfo.ConstructComponentName(typeutil.RootCoordRole, c.session.ServerID),
}, nil
}

View File

@ -22,6 +22,8 @@ import (
"sync/atomic"
"time"
"github.com/milvus-io/milvus/internal/util/metricsinfo"
"github.com/golang/protobuf/proto"
"github.com/milvus-io/milvus/internal/allocator"
etcdkv "github.com/milvus-io/milvus/internal/kv/etcd"
@ -167,6 +169,11 @@ func (c *Core) UpdateStateCode(code internalpb.StateCode) {
c.stateCode.Store(code)
}
func (c *Core) isHealthy() bool {
code := c.stateCode.Load().(internalpb.StateCode)
return code == internalpb.StateCode_Healthy
}
func (c *Core) checkInit() error {
if c.MetaTable == nil {
return fmt.Errorf("MetaTable is nil")
@ -1931,3 +1938,69 @@ func (c *Core) SegmentFlushCompleted(ctx context.Context, in *datapb.SegmentFlus
Reason: "",
}, nil
}
func (c *Core) GetMetrics(ctx context.Context, req *milvuspb.GetMetricsRequest) (*milvuspb.GetMetricsResponse, error) {
log.Debug("RootCoord.GetMetrics",
zap.Int64("node_id", c.session.ServerID),
zap.String("req", req.Request))
if !c.isHealthy() {
log.Warn("RootCoord.GetMetrics failed",
zap.Int64("node_id", c.session.ServerID),
zap.String("req", req.Request),
zap.Error(errRootCoordIsUnhealthy(c.session.ServerID)))
return &milvuspb.GetMetricsResponse{
Status: &commonpb.Status{
ErrorCode: commonpb.ErrorCode_UnexpectedError,
Reason: msgRootCoordIsUnhealthy(c.session.ServerID),
},
Response: "",
}, nil
}
metricType, err := metricsinfo.ParseMetricType(req.Request)
if err != nil {
log.Warn("RootCoord.GetMetrics failed to parse metric type",
zap.Int64("node_id", c.session.ServerID),
zap.String("req", req.Request),
zap.Error(err))
return &milvuspb.GetMetricsResponse{
Status: &commonpb.Status{
ErrorCode: commonpb.ErrorCode_UnexpectedError,
Reason: err.Error(),
},
Response: "",
}, nil
}
log.Debug("RootCoord.GetMetrics",
zap.String("metric_type", metricType))
if metricType == metricsinfo.SystemInfoMetrics {
systemInfoMetrics, err := c.getSystemInfoMetrics(ctx, req)
log.Debug("RootCoord.GetMetrics",
zap.Int64("node_id", c.session.ServerID),
zap.String("req", req.Request),
zap.String("metric_type", metricType),
zap.Any("systemInfoMetrics", systemInfoMetrics), // TODO(dragondriver): necessary? may be very large
zap.Error(err))
return systemInfoMetrics, err
}
log.Debug("RootCoord.GetMetrics failed, request metric type is not implemented yet",
zap.Int64("node_id", c.session.ServerID),
zap.String("req", req.Request),
zap.String("metric_type", metricType))
return &milvuspb.GetMetricsResponse{
Status: &commonpb.Status{
ErrorCode: commonpb.ErrorCode_UnexpectedError,
Reason: metricsinfo.MsgUnimplementedMetric,
},
Response: "",
}, nil
}

View File

@ -22,6 +22,8 @@ import (
"testing"
"time"
"github.com/milvus-io/milvus/internal/util/metricsinfo"
"github.com/golang/protobuf/proto"
etcdkv "github.com/milvus-io/milvus/internal/kv/etcd"
"github.com/milvus-io/milvus/internal/msgstream"
@ -1477,6 +1479,50 @@ func TestRootCoord(t *testing.T) {
assert.Equal(t, 3, core.chanTimeTick.GetChanNum()-numChan)
})
t.Run("get metrics", func(t *testing.T) {
// not healthy
stateSave := core.stateCode.Load().(internalpb.StateCode)
core.UpdateStateCode(internalpb.StateCode_Abnormal)
resp, err := core.GetMetrics(ctx, &milvuspb.GetMetricsRequest{})
assert.Nil(t, err)
assert.NotEqual(t, commonpb.ErrorCode_Success, resp.Status.ErrorCode)
core.UpdateStateCode(stateSave)
// failed to parse metric type
invalidRequest := "invalid request"
resp, err = core.GetMetrics(ctx, &milvuspb.GetMetricsRequest{
Request: invalidRequest,
})
assert.Nil(t, err)
assert.NotEqual(t, commonpb.ErrorCode_Success, resp.Status.ErrorCode)
// unsupported metric type
unsupportedMetricType := "unsupported"
req, err := metricsinfo.ConstructRequestByMetricType(unsupportedMetricType)
assert.Nil(t, err)
resp, err = core.GetMetrics(ctx, req)
assert.Nil(t, err)
assert.NotEqual(t, commonpb.ErrorCode_Success, resp.Status.ErrorCode)
// normal case
systemInfoMetricType := metricsinfo.SystemInfoMetrics
req, err = metricsinfo.ConstructRequestByMetricType(systemInfoMetricType)
assert.Nil(t, err)
resp, err = core.GetMetrics(ctx, req)
assert.Nil(t, err)
assert.Equal(t, commonpb.ErrorCode_Success, resp.Status.ErrorCode)
})
t.Run("get system info", func(t *testing.T) {
// normal case
systemInfoMetricType := metricsinfo.SystemInfoMetrics
req, err := metricsinfo.ConstructRequestByMetricType(systemInfoMetricType)
assert.Nil(t, err)
resp, err := core.getSystemInfoMetrics(ctx, req)
assert.Nil(t, err)
assert.Equal(t, commonpb.ErrorCode_Success, resp.Status.ErrorCode)
})
err = core.Stop()
assert.Nil(t, err)
st, err := core.GetComponentStates(ctx)

View File

@ -122,6 +122,8 @@ type RootCoordComponent interface {
SetIndexCoord(IndexCoord) error
SetQueryCoord(QueryCoord) error
SetNewProxyClient(func(sess *sessionutil.Session) (Proxy, error))
GetMetrics(ctx context.Context, req *milvuspb.GetMetricsRequest) (*milvuspb.GetMetricsResponse, error)
}
type Proxy interface {

View File

@ -67,3 +67,9 @@ type IndexCoordInfos struct {
BaseComponentInfos
// TODO(dragondriver): add more detail metrics
}
// RootCoordInfos implements ComponentInfos
type RootCoordInfos struct {
BaseComponentInfos
// TODO(dragondriver): add more detail metrics
}

View File

@ -99,3 +99,19 @@ func TestIndexCoordInfos_Codec(t *testing.T) {
assert.Equal(t, nil, err)
assert.Equal(t, infos1.Name, infos2.Name)
}
func TestRootCoordInfos_Codec(t *testing.T) {
infos1 := RootCoordInfos{
BaseComponentInfos: BaseComponentInfos{
Name: ConstructComponentName(typeutil.RootCoordRole, 1),
},
}
s, err := MarshalComponentInfos(infos1)
assert.Equal(t, nil, err)
log.Info("TestRootCoordInfos_Codec",
zap.String("marshaled_result", s))
var infos2 RootCoordInfos
err = UnmarshalComponentInfos(s, &infos2)
assert.Equal(t, nil, err)
assert.Equal(t, infos1.Name, infos2.Name)
}

View File

@ -75,6 +75,12 @@ type IndexCoordTopology struct {
Connections ConnTopology `json:"connections"`
}
// RootCoordTopology shows the whole metrics of root coordinator
type RootCoordTopology struct {
Self RootCoordInfos `json:"self"`
Connections ConnTopology `json:"connections"`
}
type ConnectionType string
const (

View File

@ -200,6 +200,35 @@ func TestIndexCoordTopology_Codec(t *testing.T) {
}
}
func TestRootCoordTopology_Codec(t *testing.T) {
topology1 := RootCoordTopology{
Self: RootCoordInfos{
BaseComponentInfos: BaseComponentInfos{
Name: ConstructComponentName(typeutil.RootCoordRole, 1),
},
},
Connections: ConnTopology{
Name: ConstructComponentName(typeutil.RootCoordRole, 1),
ConnectedComponents: []string{
ConstructComponentName(typeutil.RootCoordRole, 1),
},
},
}
s, err := MarshalTopology(topology1)
assert.Equal(t, nil, err)
log.Info("TestRootCoordTopology_Codec",
zap.String("marshaled_result", s))
var topology2 RootCoordTopology
err = UnmarshalTopology(s, &topology2)
assert.Equal(t, nil, err)
assert.Equal(t, topology1.Self, topology2.Self)
assert.Equal(t, topology1.Connections.Name, topology2.Connections.Name)
assert.Equal(t, len(topology1.Connections.ConnectedComponents), len(topology1.Connections.ConnectedComponents))
for i := range topology1.Connections.ConnectedComponents {
assert.Equal(t, topology1.Connections.ConnectedComponents[i], topology2.Connections.ConnectedComponents[i])
}
}
func TestConnTopology_Codec(t *testing.T) {
topology1 := ConnTopology{
Name: ConstructComponentName(typeutil.ProxyRole, 1),