[Bugfix] Fix np.float64 leaking into the KV transfer metrics log (#57068)

Signed-off-by: NickLucche <nicolo.lucchesi@mistral.ai>
This commit is contained in:
Nicolò Lucchesi
2026-09-16 18:09:05 +00:00
committed by GitHub
parent 9f9e1dac26
commit fc8132a5e5
7 changed files with 63 additions and 14 deletions
@@ -1075,10 +1075,14 @@ class HF3FSKVConnectorStats(KVConnectorStats):
"Num save task failed": num_failed_save,
"Num load task success": num_success_load,
"Num load task failed": num_failed_load,
"Avg save duration (ms)": round(save_duration.mean() * 1e3, 3),
"P90 save duration (ms)": round(np.percentile(save_duration, 90) * 1e3, 3),
"Avg load duration (ms)": round(load_duration.mean() * 1e3, 3),
"P90 load duration (ms)": round(np.percentile(load_duration, 90) * 1e3, 3),
"Avg save duration (ms)": round(save_duration.mean().item() * 1e3, 3),
"P90 save duration (ms)": round(
np.percentile(save_duration, 90).item() * 1e3, 3
),
"Avg load duration (ms)": round(load_duration.mean().item() * 1e3, 3),
"P90 load duration (ms)": round(
np.percentile(load_duration, 90).item() * 1e3, 3
),
}
def is_empty(self) -> bool:
@@ -126,16 +126,16 @@ class MooncakeKVConnectorStats(KVConnectorStats):
avg_mb = total_mb / n
total_time_seconds = xfer_time.sum()
throughput_mb_s = (
total_mb / total_time_seconds if total_time_seconds > 0 else 0.0
(total_mb / total_time_seconds).item() if total_time_seconds > 0 else 0.0
)
return {
"Num successful transfers": n,
"Avg xfer time (ms)": round(xfer_time.mean() * 1e3, 3),
"Avg xfer time (ms)": round(xfer_time.mean().item() * 1e3, 3),
"P90 xfer time (ms)": round(np.percentile(xfer_time, 90).item() * 1e3, 3),
"Avg MB per transfer": round(avg_mb, 3),
"Avg MB per transfer": round(avg_mb.item(), 3),
"Throughput (MB/s)": round(throughput_mb_s, 3),
"Avg number of descriptors": round(descs.mean(), 1),
"Avg number of descriptors": round(descs.mean().item(), 1),
"Num failed transfers": num_failed_transfers,
"Num failed recvs": num_failed_recvs,
"Num KV expired reqs": num_kv_expired_reqs,
@@ -115,13 +115,13 @@ class NixlKVConnectorStats(KVConnectorStats):
return {
"Num successful transfers": n,
"Avg xfer time (ms)": round(xfer_time.mean() * 1e3, 3),
"Avg xfer time (ms)": round(xfer_time.mean().item() * 1e3, 3),
"P90 xfer time (ms)": round(np.percentile(xfer_time, 90).item() * 1e3, 3),
"Avg post time (ms)": round(post_time.mean() * 1e3, 3),
"Avg post time (ms)": round(post_time.mean().item() * 1e3, 3),
"P90 post time (ms)": round(np.percentile(post_time, 90).item() * 1e3, 3),
"Avg MB per transfer": round(avg_mb, 3),
"Throughput (MB/s)": round(throughput_mb_s, 3),
"Avg number of descriptors": round(descs.mean(), 1),
"Avg MB per transfer": round(avg_mb.item(), 3),
"Throughput (MB/s)": round(throughput_mb_s.item(), 3),
"Avg number of descriptors": round(descs.mean().item(), 1),
}
@property