提交 8f58d564 编写于 作者: G godchen 提交者: yefu.chen

Perfect trace and add trace init

Signed-off-by: Ngodchen <qingxiang.chen@zilliz.com>
上级 035db4e4
...@@ -10,12 +10,14 @@ import ( ...@@ -10,12 +10,14 @@ import (
"github.com/golang/protobuf/proto" "github.com/golang/protobuf/proto"
"go.uber.org/zap" "go.uber.org/zap"
oplog "github.com/opentracing/opentracing-go/log"
"github.com/zilliztech/milvus-distributed/internal/log" "github.com/zilliztech/milvus-distributed/internal/log"
"github.com/zilliztech/milvus-distributed/internal/msgstream" "github.com/zilliztech/milvus-distributed/internal/msgstream"
"github.com/zilliztech/milvus-distributed/internal/proto/commonpb" "github.com/zilliztech/milvus-distributed/internal/proto/commonpb"
"github.com/zilliztech/milvus-distributed/internal/proto/internalpb" "github.com/zilliztech/milvus-distributed/internal/proto/internalpb"
"github.com/zilliztech/milvus-distributed/internal/proto/milvuspb" "github.com/zilliztech/milvus-distributed/internal/proto/milvuspb"
"github.com/zilliztech/milvus-distributed/internal/util/trace" "github.com/zilliztech/milvus-distributed/internal/util/trace"
"github.com/zilliztech/milvus-distributed/internal/util/tsoutil"
) )
type searchCollection struct { type searchCollection struct {
...@@ -135,18 +137,29 @@ func (s *searchCollection) receiveSearchMsg() { ...@@ -135,18 +137,29 @@ func (s *searchCollection) receiveSearchMsg() {
log.Debug("stop searchCollection's receiveSearchMsg", zap.Int64("collectionID", s.collectionID)) log.Debug("stop searchCollection's receiveSearchMsg", zap.Int64("collectionID", s.collectionID))
return return
case sm := <-s.msgBuffer: case sm := <-s.msgBuffer:
sp, ctx := trace.StartSpanFromContext(sm.TraceCtx())
sm.SetTraceCtx(ctx)
log.Debug("get search message from msgBuffer", log.Debug("get search message from msgBuffer",
zap.Int64("msgID", sm.ID()), zap.Int64("msgID", sm.ID()),
zap.Int64("collectionID", sm.CollectionID)) zap.Int64("collectionID", sm.CollectionID))
serviceTime := s.getServiceableTime() serviceTime := s.getServiceableTime()
if sm.BeginTs() > serviceTime { if sm.BeginTs() > serviceTime {
bt, _ := tsoutil.ParseTS(sm.BeginTs())
st, _ := tsoutil.ParseTS(serviceTime)
log.Debug("querynode::receiveSearchMsg: add to unsolvedMsgs", log.Debug("querynode::receiveSearchMsg: add to unsolvedMsgs",
zap.Any("sm.BeginTs", sm.BeginTs()), zap.Any("sm.BeginTs", bt),
zap.Any("serviceTime", serviceTime), zap.Any("serviceTime", st),
zap.Any("delta seconds", (sm.BeginTs()-serviceTime)/(1000*1000*1000)), zap.Any("delta seconds", (sm.BeginTs()-serviceTime)/(1000*1000*1000)),
zap.Any("collectionID", s.collectionID), zap.Any("collectionID", s.collectionID),
) )
s.addToUnsolvedMsg(sm) s.addToUnsolvedMsg(sm)
sp.LogFields(
oplog.String("send to unsolved buffer", "send to unsolved buffer"),
oplog.Object("begin ts", bt),
oplog.Object("serviceTime", st),
oplog.Float64("delta seconds", float64(sm.BeginTs()-serviceTime)/(1000.0*1000.0*1000.0)),
)
sp.Finish()
continue continue
} }
log.Debug("doing search in receiveSearchMsg...", log.Debug("doing search in receiveSearchMsg...",
...@@ -166,6 +179,7 @@ func (s *searchCollection) receiveSearchMsg() { ...@@ -166,6 +179,7 @@ func (s *searchCollection) receiveSearchMsg() {
log.Debug("do search done in receiveSearchMsg", log.Debug("do search done in receiveSearchMsg",
zap.Int64("msgID", sm.ID()), zap.Int64("msgID", sm.ID()),
zap.Int64("collectionID", sm.CollectionID)) zap.Int64("collectionID", sm.CollectionID))
sp.Finish()
} }
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册