Add filtering for failed requests in benchmark outputs (#4448)

Filter out requests with end_timestamp == 0.0
This commit is contained in:
Zhang Yulong
2025-10-16 14:57:47 +08:00
committed by GitHub
parent 9dc3968c13
commit 98f8c3703a

View File

@@ -473,6 +473,9 @@ async def benchmark(
if half > 0:
benchmark_outputs = outputs[half : n - half]
# 先过滤掉 end_timestamp == 0.0 的请求(失败请求)
benchmark_outputs = [o for o in benchmark_outputs if o.end_timestamp != 0.0]
# 根据收到最后一个chunk的时间戳计算总时长
if len(benchmark_outputs) >= 2:
benchmark_duration = benchmark_outputs[-1].end_timestamp - benchmark_outputs[0].end_timestamp