未验证 提交 7a8e4945 编写于 作者: B Bingyi Sun 提交者: GitHub

Add log in datacoord (#13600)

Signed-off-by: Nsunby <bingyi.sun@zilliz.com>
Co-authored-by: Nsunby <bingyi.sun@zilliz.com>
上级 efd86e8c
...@@ -24,6 +24,7 @@ import ( ...@@ -24,6 +24,7 @@ import (
"time" "time"
"github.com/milvus-io/milvus/internal/common" "github.com/milvus-io/milvus/internal/common"
"github.com/milvus-io/milvus/internal/logutil"
"github.com/milvus-io/milvus/internal/util/trace" "github.com/milvus-io/milvus/internal/util/trace"
...@@ -36,6 +37,8 @@ import ( ...@@ -36,6 +37,8 @@ import (
"go.uber.org/zap" "go.uber.org/zap"
) )
const moduleName = "DataCoord"
// checks whether server in Healthy State // checks whether server in Healthy State
func (s *Server) isClosed() bool { func (s *Server) isClosed() bool {
return atomic.LoadInt64(&s.isServing) != ServerStateHealthy return atomic.LoadInt64(&s.isServing) != ServerStateHealthy
...@@ -229,6 +232,8 @@ func (s *Server) GetInsertBinlogPaths(ctx context.Context, req *datapb.GetInsert ...@@ -229,6 +232,8 @@ func (s *Server) GetInsertBinlogPaths(ctx context.Context, req *datapb.GetInsert
// GetCollectionStatistics returns statistics for collection // GetCollectionStatistics returns statistics for collection
// for now only row count is returned // for now only row count is returned
func (s *Server) GetCollectionStatistics(ctx context.Context, req *datapb.GetCollectionStatisticsRequest) (*datapb.GetCollectionStatisticsResponse, error) { 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{ resp := &datapb.GetCollectionStatisticsResponse{
Status: &commonpb.Status{ Status: &commonpb.Status{
ErrorCode: commonpb.ErrorCode_UnexpectedError, ErrorCode: commonpb.ErrorCode_UnexpectedError,
...@@ -241,6 +246,7 @@ func (s *Server) GetCollectionStatistics(ctx context.Context, req *datapb.GetCol ...@@ -241,6 +246,7 @@ func (s *Server) GetCollectionStatistics(ctx context.Context, req *datapb.GetCol
nums := s.meta.GetNumRowsOfCollection(req.CollectionID) nums := s.meta.GetNumRowsOfCollection(req.CollectionID)
resp.Status.ErrorCode = commonpb.ErrorCode_Success resp.Status.ErrorCode = commonpb.ErrorCode_Success
resp.Stats = append(resp.Stats, &commonpb.KeyValuePair{Key: "row_count", Value: strconv.FormatInt(nums, 10)}) 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 return resp, nil
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册