Selaa lähdekoodia

优化 异常事件-柱状图,异常事件-列表

路佳明 1 kuukausi sitten
vanhempi
säilyke
52229ef95a
1 muutettua tiedostoa jossa 4 lisäystä ja 2 poistoa
  1. 4 2
      app/observe/service/event.go

+ 4 - 2
app/observe/service/event.go

@@ -99,7 +99,8 @@ func (e *Event) EventStatistic(c *dto.EventStatisticReq, result *[]dto.EventStat
 	if c.Kind != "" && c.SubconditionValue != "" {
 		switch c.Kind {
 		case "app":
-			db.Where("((ParentSpanId='' and SpanKind='SPAN_KIND_SERVER' and SpanAttributes['http.method'] != '' and SpanAttributes['rpc.system']='') OR SpanAttributes['db.system'] != '')") // 要求 只要http请求 和数据库 两种异常
+			// db.Where("((ParentSpanId='' and SpanKind='SPAN_KIND_SERVER' and SpanAttributes['http.method'] != '' and SpanAttributes['rpc.system']='') OR SpanAttributes['db.system'] != '')") // 要求 只要http请求 和数据库 两种异常
+			db.Where("((ParentSpanId='' AND SpanKind in ('SPAN_KIND_CLIENT', 'SPAN_KIND_SERVER')) OR SpanAttributes['db.system'] != '')") // 由于客户发现,好多业务错误的情况下,这里依然没有异常不正常,所以放开一些限制
 		case "biz":
 			// 改为错误分布, 与错误率*业务请求总数对上
 			start := time.Unix(c.StartTime, 0).Truncate(time.Hour).Format(time.DateTime)
@@ -161,7 +162,8 @@ func (e *Event) EventLists(c *dto.EventStatisticReq, result *[]dto.EventListsRes
 	db.Where("Timestamp >= ? AND Timestamp <= ?", c.StartTime, c.EndTime)
 	// db.Where("StatusCode = 'STATUS_CODE_ERROR' AND StatusMessage != '' AND StatusMessage != 'status code:0'")
 	db.Where("StatusCode='STATUS_CODE_ERROR' AND StatusMessage!='' and StatusMessage != 'status code:0'").
-		Where("((ParentSpanId='' and  SpanKind='SPAN_KIND_SERVER' and SpanAttributes['http.method'] != '' and SpanAttributes['rpc.system']='') OR SpanAttributes['db.system'] != '')") // 要求 只要root span和数据库 两种异常
+		Where("((ParentSpanId='' AND SpanKind in ('SPAN_KIND_CLIENT', 'SPAN_KIND_SERVER')) OR SpanAttributes['db.system'] != '')")
+		// Where("((ParentSpanId='' and  SpanKind='SPAN_KIND_SERVER' and SpanAttributes['http.method'] != '' and SpanAttributes['rpc.system']='') OR SpanAttributes['db.system'] != '')") // 要求 只要root span和数据库 两种异常
 	db.Group("substring(StatusMessage, 1, 15)")
 	db.Group("ServiceName")
 	if err := db.Order("StatusMessageCount DESC;").Find(&res).Error; err != nil {