Skip to content

Commit

Permalink
fix: 异常监控数据增加日志打印 (#1622)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssongliu authored Jul 12, 2023
1 parent ec05e81 commit 7dd5082
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions backend/app/service/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,16 @@ func loadNetIO() {
if net2.BytesSent != 0 && net1.BytesSent != 0 {
itemNet.Up = float64(net2.BytesSent-net1.BytesSent) / 1024 / 60
}
if itemNet.Up > 100000000 {
if itemNet.Up > 10485760 {
itemNet.Up = 0
global.LOG.Errorf("net2: %v, net1: %v, BytesSent: %v \n", net2.BytesSent, net1.BytesSent, float64(net2.BytesSent-net1.BytesSent)/1024/60)
}

if net2.BytesRecv != 0 && net1.BytesRecv != 0 {
itemNet.Down = float64(net2.BytesRecv-net1.BytesRecv) / 1024 / 60
}
if itemNet.Down > 100000000 {
if itemNet.Down > 10485760 {
itemNet.Down = 0
global.LOG.Errorf("net2: %v, net1: %v, BytesRecv: %v \n", net2.BytesRecv, net1.BytesRecv, float64(net2.BytesRecv-net1.BytesRecv)/1024/60)
}
netList = append(netList, itemNet)
Expand Down
2 changes: 1 addition & 1 deletion backend/app/service/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (u *SnapshotService) SnapshotImport(req dto.SnapshotImport) error {
return fmt.Errorf("incorrect snapshot request body: %v", req.Names)
}
for _, snapName := range req.Names {
snap, _ := snapshotRepo.Get(commonRepo.WithByName(snapName))
snap, _ := snapshotRepo.Get(commonRepo.WithByName(strings.ReplaceAll(snapName, ".tar.gz", "")))
if snap.ID != 0 {
return constant.ErrRecordExist
}
Expand Down

0 comments on commit 7dd5082

Please sign in to comment.