优化 query_live_traffic_stats 实现 #59
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Requested by @callmefisher
此 PR 优化了
query_live_traffic_stats函数的实现,提供更有用的流量和带宽统计数据。主要变更
include_raw_data参数,当设置为true时返回原始数据供下载使用示例响应
默认响应(不包含原始数据):
{ "status": "success", "summary": { "total_traffic_bytes": 1073741824, "total_traffic_formatted": "1.00 GB", "data_points_count": 288, "average_bandwidth_bps": 29826.67, "average_bandwidth_formatted": "29.83 Kbps", "peak_bandwidth_bps": 102400.00, "peak_bandwidth_formatted": "102.40 Kbps", "granularity": "5 minutes" } }包含原始数据(
include_raw_data=true):{ "status": "success", "summary": { ... }, "raw_data": [...], "data_points": [...] }测试
此更改向后兼容,现有调用将继续工作但返回优化后的数据格式。
Fixes #58