Browse Source

span id去重, 兼容数据异常情况

路佳明 1 month ago
parent
commit
b262dd2a4d
1 changed files with 1 additions and 0 deletions
  1. 1 0
      app/observe/service/trace.go

+ 1 - 0
app/observe/service/trace.go

@@ -110,6 +110,7 @@ func (t *Trace) GetPage(ctx context.Context, req *dto.TraceListReq, result *[]dt
 func (t *Trace) GetSpans(ctx context.Context, param *dto.TraceDetailReq, root *dto.TraceDetailResp) error {
 	list := []models.Trace{}
 	db := t.ChOrm.Table(models.TableNameTrace).
+		Distinct("*"). // 由于数据库中存在parent id生蚝的情况,可能是由于网张原因导致的,这里去一下重
 		// Select("ServiceName, SpanName, SpanKind, SpanId, ParentSpanId, Duration/1e6 AS Duration").
 		Where("TraceId=?", param.TraceId)