mirror of https://github.com/milvus-io/milvus.git
Add log in datacoord (#13600)
Signed-off-by: sunby <bingyi.sun@zilliz.com> Co-authored-by: sunby <bingyi.sun@zilliz.com>pull/13821/head
parent
efd86e8c1e
commit
7a8e49451f
|
@ -24,6 +24,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/milvus-io/milvus/internal/common"
|
||||
"github.com/milvus-io/milvus/internal/logutil"
|
||||
|
||||
"github.com/milvus-io/milvus/internal/util/trace"
|
||||
|
||||
|
@ -36,6 +37,8 @@ import (
|
|||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
const moduleName = "DataCoord"
|
||||
|
||||
// checks whether server in Healthy State
|
||||
func (s *Server) isClosed() bool {
|
||||
return atomic.LoadInt64(&s.isServing) != ServerStateHealthy
|
||||
|
@ -229,6 +232,8 @@ func (s *Server) GetInsertBinlogPaths(ctx context.Context, req *datapb.GetInsert
|
|||
// GetCollectionStatistics returns statistics for collection
|
||||
// for now only row count is returned
|
||||
func (s *Server) GetCollectionStatistics(ctx context.Context, req *datapb.GetCollectionStatisticsRequest) (*datapb.GetCollectionStatisticsResponse, error) {
|
||||
ctx = logutil.WithModule(ctx, moduleName)
|
||||
logutil.Logger(ctx).Debug("received request to get collection statistics")
|
||||
resp := &datapb.GetCollectionStatisticsResponse{
|
||||
Status: &commonpb.Status{
|
||||
ErrorCode: commonpb.ErrorCode_UnexpectedError,
|
||||
|
@ -241,6 +246,7 @@ func (s *Server) GetCollectionStatistics(ctx context.Context, req *datapb.GetCol
|
|||
nums := s.meta.GetNumRowsOfCollection(req.CollectionID)
|
||||
resp.Status.ErrorCode = commonpb.ErrorCode_Success
|
||||
resp.Stats = append(resp.Stats, &commonpb.KeyValuePair{Key: "row_count", Value: strconv.FormatInt(nums, 10)})
|
||||
logutil.Logger(ctx).Debug("success to get collection statistics", zap.Any("response", resp))
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue