Commit b6c55ef5 authored by vrg0's avatar vrg0

当qps获取不成功时,显示未知

parent b5f98256
......@@ -58,6 +58,8 @@ func (p *Path) initQps() {
maxqps, ok := queryOneAndToInt(sql)
if ok {
p.maxqps = maxqps
} else {
p.maxqps = -1
}
}
......
......@@ -26,6 +26,9 @@ var (
//Human-readable number
func hrn(n int) string {
if n < 0 {
return "未知"
}
num := float64(n)
unit := float64(1024)
if num < unit {
......
......@@ -47,7 +47,7 @@ func NewService(name string, startTime time.Time, endTime time.Time) *Service {
endTime: endTime,
pathMap: make(map[string]*Path),
nodeMap: make(map[string]*Node),
maxqps: 0,
maxqps: -1,
}
//初始化path
......@@ -97,6 +97,8 @@ func (s *Service) initQps() {
maxqps, ok := queryOneAndToInt(sql)
if ok {
s.maxqps = maxqps
} else {
s.maxqps = -1
}
}
......
......@@ -194,7 +194,7 @@ func (sm *ServiceMap) GetMaxQps() int {
}
//取最大值
max := 0
max := -1
for _, x := range maxList {
if x > max {
max = x
......@@ -211,7 +211,7 @@ func (sm *ServiceMap) getMaxQps(start time.Time, end time.Time) int {
sql := fmt.Sprintf(sqlMaxQps, start.UnixNano(), end.UnixNano())
maxqps, ok := queryOneAndToInt(sql)
if !ok {
return 0
return -1
}
return maxqps
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment