[Metrics][KV Offload] Add vllm:kv_offload_config_info - generic info metrics for offloading the offloading connector (#56867)
Signed-off-by: Amir Friedman <Amir.Friedman1@ibm.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com> Co-authored-by: Or Ozeri <oro@il.ibm.com>
This commit is contained in:
co-authored by
Claude Opus 5
Or Ozeri
parent
3a5a6b11a3
commit
775fefa804
@@ -10,11 +10,14 @@ TieringOffloadingManager without requiring actual storage or network backends.
|
||||
|
||||
import logging
|
||||
from collections.abc import Iterable
|
||||
from typing import TYPE_CHECKING, ClassVar
|
||||
from dataclasses import dataclass
|
||||
from typing import TYPE_CHECKING, Any, ClassVar
|
||||
|
||||
from typing_extensions import override
|
||||
|
||||
from vllm.v1.kv_offload.base import (
|
||||
ConfigInfo,
|
||||
ConfigInfoMapping,
|
||||
LookupResult,
|
||||
Medium,
|
||||
OffloadKey,
|
||||
@@ -34,6 +37,17 @@ if TYPE_CHECKING:
|
||||
from vllm.v1.kv_offload.tiering.backpressure import BackpressureDetector
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class ExampleTierInfo(ConfigInfo):
|
||||
"""Config facts of one ExampleSecondaryTierManager.
|
||||
|
||||
A field name is the label name. A secondary tier needs no name of its own
|
||||
for the tier, because the tier label tells the series of the tiers apart.
|
||||
"""
|
||||
|
||||
example_info: int
|
||||
|
||||
|
||||
class ExampleSecondaryTierManager(SecondaryTierManager):
|
||||
"""A simple in-memory secondary tier.
|
||||
|
||||
@@ -69,6 +83,8 @@ class ExampleSecondaryTierManager(SecondaryTierManager):
|
||||
backpressure_detector=backpressure_detector,
|
||||
)
|
||||
|
||||
self._config_info = ExampleTierInfo(example_info=custom_param)
|
||||
|
||||
logger.info(
|
||||
"ExampleSecondaryTierManager initialized with custom_param=%d", custom_param
|
||||
)
|
||||
@@ -81,6 +97,15 @@ class ExampleSecondaryTierManager(SecondaryTierManager):
|
||||
assert primary_kv_view.strides is not None
|
||||
self._chunk_size = primary_kv_view.strides[0]
|
||||
|
||||
@classmethod
|
||||
@override
|
||||
def config_info_keys(cls, tier_config: dict[str, Any]) -> tuple[str, ...]:
|
||||
return ExampleTierInfo.config_info_keys()
|
||||
|
||||
@override
|
||||
def config_info(self) -> ConfigInfoMapping:
|
||||
return self._config_info.as_config_info()
|
||||
|
||||
@override
|
||||
def lookup(self, key: OffloadKey, req_context: ReqContext) -> LookupResult:
|
||||
"""Check whether a chunk exists in this secondary tier.
|
||||
|
||||
Reference in New Issue
Block a user