Skip to content

Commit

Permalink
fix(apps/metrics/prometheus): 修复统计报表请求数为负数问题 (#1125)
Browse files Browse the repository at this point in the history
  • Loading branch information
F-cq authored Nov 25, 2024
1 parent 6b6810d commit 5ba5e99
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ def get_data_differ_number(data: dict) -> int:
last_number = datapoints[-2][0] if last_value is None else last_value

# 返回计算的差值,并确保结果是整数
return int(last_number) - int(first_number)
total = int(last_number) - int(first_number)
return 0 if total < 0 else total

# 如果没有有效数据,返回0
return 0
Expand Down

0 comments on commit 5ba5e99

Please sign in to comment.