|
@@ -116,7 +116,7 @@ func (e *Event) EventStatistic(c *dto.EventStatisticReq, result *[]dto.EventStat
|
|
|
}
|
|
|
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 (ParentSpanId='' OR SpanAttributes['db.system'] != '')") // 要求 只要root span和数据库 两种异常
|
|
|
+ db.Where("StatusCode='STATUS_CODE_ERROR' AND ((SpanAttributes['http.method'] != '' and SpanAttributes['rpc.system']='') OR SpanAttributes['db.system'] != '')") // 要求 只要http请求 和数据库 两种异常
|
|
|
db.Group("FiveMinuteInterval")
|
|
|
if err := db.Order("FiveMinuteInterval, StatusMessageCount Desc").Find(&result).Error; err != nil {
|
|
|
return errors.Wrap(err, "计算范围时间内的异常失败")
|
|
@@ -149,7 +149,7 @@ 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 (ParentSpanId='' OR SpanAttributes['db.system'] != '')") // 要求 只要root span和数据库 两种异常
|
|
|
+ db.Where("StatusCode='STATUS_CODE_ERROR' 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 {
|