Fix log when building index (#20302)

Signed-off-by: longjiquan <jiquan.long@zilliz.com>

Signed-off-by: longjiquan <jiquan.long@zilliz.com>
pull/20013/head
Jiquan Long 2022-11-03 18:19:35 +08:00 committed by GitHub
parent 7d188ea39a
commit e7103310b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 10 deletions

View File

@ -37,7 +37,8 @@ func (i *IndexNode) CreateJob(ctx context.Context, req *indexpb.CreateJobRequest
zap.Int64("IndexVersion", req.IndexVersion),
zap.Strings("DataPaths", req.DataPaths),
zap.Any("TypeParams", req.TypeParams),
zap.Any("IndexParams", req.IndexParams))
zap.Any("IndexParams", req.IndexParams),
zap.Int64("num_rows", req.GetNumRows()))
sp, _ := trace.StartSpanFromContextWithOperationName(ctx, "IndexNode-CreateIndex")
defer sp.Finish()
sp.SetTag("IndexBuildID", strconv.FormatInt(req.BuildID, 10))

View File

@ -219,10 +219,9 @@ func (it *indexBuildTask) LoadData(ctx context.Context) error {
log.Ctx(ctx).Warn("loadKey failed", zap.Error(err))
return err
}
loadVectorDuration := it.tr.RecordSpan().Milliseconds()
log.Ctx(ctx).Debug("indexnode load data success")
it.tr.Record("load field data done")
metrics.IndexNodeLoadFieldLatency.WithLabelValues(strconv.FormatInt(Params.IndexNodeCfg.GetNodeID(), 10)).Observe(float64(loadVectorDuration))
loadFieldDataLatency := it.tr.CtxRecord(ctx, "load field data done")
metrics.IndexNodeLoadFieldLatency.WithLabelValues(strconv.FormatInt(Params.IndexNodeCfg.GetNodeID(), 10)).Observe(float64(loadFieldDataLatency.Milliseconds()))
err = it.decodeBlobs(ctx, blobs)
if err != nil {
@ -256,9 +255,10 @@ func (it *indexBuildTask) BuildIndex(ctx context.Context) error {
return err
}
}
metrics.IndexNodeKnowhereBuildIndexLatency.WithLabelValues(strconv.FormatInt(Params.IndexNodeCfg.GetNodeID(), 10)).Observe(float64(it.tr.RecordSpan().Milliseconds()))
it.tr.Record("build index done")
buildIndexLatency := it.tr.Record("build index done")
metrics.IndexNodeKnowhereBuildIndexLatency.WithLabelValues(strconv.FormatInt(Params.IndexNodeCfg.GetNodeID(), 10)).Observe(float64(buildIndexLatency.Milliseconds()))
indexBlobs, err := it.index.Serialize()
if err != nil {
log.Ctx(ctx).Error("IndexNode index Serialize failed", zap.Error(err))
@ -371,9 +371,8 @@ func (it *indexBuildTask) BuildDiskAnnIndex(ctx context.Context) error {
}
}
metrics.IndexNodeKnowhereBuildIndexLatency.WithLabelValues(strconv.FormatInt(Params.IndexNodeCfg.GetNodeID(), 10)).Observe(float64(it.tr.RecordSpan()))
it.tr.Record("build index done")
buildIndexLatency := it.tr.Record("build index done")
metrics.IndexNodeKnowhereBuildIndexLatency.WithLabelValues(strconv.FormatInt(Params.IndexNodeCfg.GetNodeID(), 10)).Observe(float64(buildIndexLatency.Milliseconds()))
fileInfos, err := it.index.GetIndexFileInfo()
if err != nil {