在监控系统运行时上报API连接状况

This commit is contained in:
GoEdgeLab
2022-11-22 11:23:39 +08:00
parent 2c4c64d0f5
commit 33dd1e9305
4 changed files with 102 additions and 4 deletions

View File

@@ -287,14 +287,15 @@ func (this *RPCClient) pickConn() *grpc.ClientConn {
func (this *RPCClient) Invoke(ctx context.Context, method string, args interface{}, reply interface{}, opts ...grpc.CallOption) error {
var conn = this.pickConn()
if conn == nil {
return errors.New("can not get available grpc connection")
return errors.New("could not get available grpc connection")
}
return conn.Invoke(ctx, method, args, reply, opts...)
}
func (this *RPCClient) NewStream(ctx context.Context, desc *grpc.StreamDesc, method string, opts ...grpc.CallOption) (grpc.ClientStream, error) {
var conn = this.pickConn()
if conn == nil {
return nil, errors.New("can not get available grpc connection")
return nil, errors.New("could not get available grpc connection")
}
return conn.NewStream(ctx, desc, method, opts...)
}