fix reduce latency metric (#19479)

Signed-off-by: wgcn <1026688210@qq.com>

Signed-off-by: wgcn <1026688210@qq.com>
pull/19247/head
wgcn 2022-09-27 19:40:54 +08:00 committed by GitHub
parent 39be6e455a
commit 6972efe6ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -231,7 +231,11 @@ func (s *searchTask) reduceResults(ctx context.Context, searchReq *searchRequest
log.Ctx(ctx).Warn("marshal for historical results error", zap.Int64("msgID", s.ID()), zap.Error(err))
return err
}
defer deleteSearchResultDataBlobs(blobs)
defer func() {
deleteSearchResultDataBlobs(blobs)
s.reduceDur = s.tr.RecordSpan()
}()
for i := 0; i < cnt; i++ {
blob, err := getSearchResultDataBlob(blobs, i)
@ -274,8 +278,9 @@ func (s *searchTask) reduceResults(ctx context.Context, searchReq *searchRequest
SlicedNumCount: 1,
}
}
s.reduceDur = s.tr.RecordSpan()
}
s.reduceDur = s.tr.RecordSpan()
return nil
}