[Metrics] Expose cached prompt tokens by cache tier (#56318)

Signed-off-by: Cam Quilici <cjquilici@gmail.com>
Signed-off-by: Cam Quilici <cameron@semianalysis.com>
Co-authored-by: Cam Quilici <cameron@semianalysis.com>
Co-authored-by: Nick Hill <nickhill123@gmail.com>
Co-authored-by: Yifan Qiao <yifanqiao@inferact.ai>
This commit is contained in:
Cameron Quilici
2026-10-06 14:52:05 -04:00
committed by GitHub
co-authored by Cam Quilici Nick Hill Yifan Qiao
parent ad0f67a7ec
commit e37e51dd24
36 changed files with 1005 additions and 44 deletions
+13
View File
@@ -18,6 +18,7 @@ if TYPE_CHECKING:
from vllm.v1.kv_hints import KvHintsEnvelope
from vllm.v1.kv_offload.config import OffloadingConfig
from vllm.v1.metrics.cache_hit_source import CacheHitSource
# `OffloadKey` identifies an offloaded block. It combines a block hash with
# its KV cache group index, encoded as raw bytes to avoid tuple GC overhead.
@@ -248,6 +249,18 @@ class OffloadingManager(ABC):
"""
pass
def get_load_source(
self, key: OffloadKey, req_context: ReqContext
) -> CacheHitSource:
"""Return the cache tier that supplied a successful lookup.
This is queried only after ``lookup`` resolves to ``HIT``. Composing
managers can override it to retain the origin across asynchronous
promotion into a primary tier. The default keeps out-of-tree managers
compatible while making unknown provenance explicit.
"""
return CacheHitSource.EXTERNAL_UNSPECIFIED
@abstractmethod
def prepare_load(
self,