add FastApi实时性能监控

This commit is contained in:
jxxghp
2025-08-01 17:47:55 +08:00
parent 8ab233baef
commit 1dd3af44b5
10 changed files with 857 additions and 21 deletions

View File

@@ -494,11 +494,11 @@ class SystemUtils:
time.sleep(1) # 等待1秒
# 获取1秒后的网络统计
net_io_2 = psutil.net_io_counters()
# 计算1秒内的流量变化
upload_speed = net_io_2.bytes_sent - net_io_1.bytes_sent
download_speed = net_io_2.bytes_recv - net_io_1.bytes_recv
return [upload_speed, download_speed]
@staticmethod