增加多个服务流量、带宽统计API

This commit is contained in:
刘祥超
2022-10-03 19:28:03 +08:00
parent f7dd9e3f39
commit 1db4661c75
16 changed files with 779 additions and 40 deletions

View File

@@ -477,6 +477,7 @@ func (this *ServerStatBoardService) ComposeServerStatBoard(ctx context.Context,
Day: stat.Day,
TimeAt: stat.TimeAt,
Bytes: int64(stat.Bytes),
Bits: int64(stat.Bytes * 8),
}
}
}
@@ -486,12 +487,14 @@ func (this *ServerStatBoardService) ComposeServerStatBoard(ctx context.Context,
if ok {
pbBandwidthStats = append(pbBandwidthStats, stat)
} else {
var bytes = ServerBandwidthGetCacheBytes(req.ServerId, minute.Day, minute.Minute) // 从当前缓存中读取
pbBandwidthStats = append(pbBandwidthStats, &pb.ServerBandwidthStat{
Id: 0,
ServerId: req.ServerId,
Day: minute.Day,
TimeAt: minute.Minute,
Bytes: ServerBandwidthGetCacheBytes(req.ServerId, minute.Day, minute.Minute), // 从当前缓存中读取
Bytes: bytes,
Bits: bytes * 8,
})
}
}