From 309af6e6e1e1bbc2badd23774cec7634947dc0ba Mon Sep 17 00:00:00 2001 From: "minke.yu" Date: Wed, 4 Nov 2026 19:14:02 +0800 Subject: [PATCH] observability: record prefetch ready latency on the L3 hit success path _handle_prefetch_result() retires the operation with a direct del ongoing_prefetch[request] instead of _retire_ongoing_prefetch(), so the ready-latency hook only ever saw miss/revoke paths: with a cache-hit workload storage_prefetch_ready_seconds{result="hit"} stayed at 0 even though storage_prefetch_hit_tokens_total was moving ~312k tok/s. Observe right after the del, classifying by loaded_from_storage. --- python/sglang/srt/mem_cache/unified_radix_cache.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/python/sglang/srt/mem_cache/unified_radix_cache.py b/python/sglang/srt/mem_cache/unified_radix_cache.py index 3fb717ee18..4dd52bc3d4 100644 --- a/python/sglang/srt/mem_cache/unified_radix_cache.py +++ b/python/sglang/srt/mem_cache/unified_radix_cache.py @@ -2521,6 +2521,9 @@ class UnifiedRadixCache(BasePrefixCache): self.dec_host_lock_ref(last_host_node_id, anchor_lock_params) del self.ongoing_prefetch[request] + # Success path retires here instead of _retire_ongoing_prefetch(); the + # ready-latency metric must cover it or every L3 hit goes unmeasured. + self._observe_prefetch_ready(request, loaded_from_storage > 0) self.cache_controller.prefetch_tokens_occupied -= len(prefetch_key) self.prefetch_loaded_tokens_by_reqid[request] = loaded_from_storage