fix bug
Former-commit-id: 9c7262a85ad9248a248fd231adcdcb76bd7283e6
This commit is contained in:
parent
e8a9843dd0
commit
373a347ea6
|
@ -18,9 +18,9 @@ type (
|
|||
}
|
||||
|
||||
ResourceUsage {
|
||||
cpu int64 `json:"cpu"`
|
||||
memory int64 `json:"memory"`
|
||||
storage int64 `json:"storage"`
|
||||
cpu float64 `json:"cpu"`
|
||||
memory float64 `json:"memory"`
|
||||
storage float64 `json:"storage"`
|
||||
}
|
||||
|
||||
ResourceTotal {
|
||||
|
|
|
@ -32,6 +32,6 @@ func (l *ResourceCenterInfoLogic) ResourceCenterInfo(req *types.ResourceCenterIn
|
|||
|
||||
l.svcCtx.DbEngin.Raw("select SUm(cpu_total) as cpu,sum(mem_total) as memory,SUM(disk_total) as storage FROM sc_node_avail_info where participant_id = ? GROUP BY created_time ORDER BY created_time desc LIMIT 1", req.ParticipantId).Scan(&resp.ResourceTotal)
|
||||
|
||||
l.svcCtx.DbEngin.Raw("select IFNULL(SUM(cpu_usable)/COUNT(*),0)as cpu,IFNULL(sum(mem_avail)/SUM(mem_total),0) as memory,IFNULL(sum(disk_avail)/SUM(disk_total),0) as storage FROM sc_node_avail_info where participant_id = ? GROUP BY created_time ORDER BY created_time desc LIMIT 1", req.ParticipantId).Scan(&resp.ResourceUsage)
|
||||
l.svcCtx.DbEngin.Raw("select IFNULL(SUM(cpu_usable)/COUNT(*),0)as cpu,IFNULL(sum(mem_avail)/SUM(mem_total),0) as memory,IFNULL(sum(disk_avail)/SUM(disk_total),0) as storage FROM sc_node_avail_info where cpu_total != 0 and participant_id = ? GROUP BY created_time ORDER BY created_time desc LIMIT 1", req.ParticipantId).Scan(&resp.ResourceUsage)
|
||||
return
|
||||
}
|
||||
|
|
|
@ -13,9 +13,9 @@ type ResourceCenterInfoResp struct {
|
|||
}
|
||||
|
||||
type ResourceUsage struct {
|
||||
Cpu int64 `json:"cpu"`
|
||||
Memory int64 `json:"memory"`
|
||||
Storage int64 `json:"storage"`
|
||||
Cpu float64 `json:"cpu"`
|
||||
Memory float64 `json:"memory"`
|
||||
Storage float64 `json:"storage"`
|
||||
}
|
||||
|
||||
type ResourceTotal struct {
|
||||
|
|
Loading…
Reference in New Issue