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.
This commit is contained in:
2026-11-04 19:14:02 +08:00
parent 1a274df27e
commit 309af6e6e1
@@ -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