[EC Connector] Add Metrics Collection (#54960)

Signed-off-by: omerpaz95 <omerpaz95@gmail.com>
This commit is contained in:
omerpaz95
2026-09-17 10:36:23 +08:00
committed by GitHub
parent 2307a1d16c
commit fa3622a4a1
12 changed files with 472 additions and 3 deletions
@@ -35,6 +35,12 @@ from vllm.v1.outputs import ECConnectorOutput
if TYPE_CHECKING:
from vllm.config import VllmConfig
from vllm.distributed.ec_transfer.ec_connector.metrics import (
ECConnectorPromMetrics,
ECConnectorStats,
PromMetric,
PromMetricT,
)
from vllm.v1.request import Request
logger = init_logger(__name__)
@@ -219,6 +225,17 @@ class ECConnectorBase(ABC):
"""
return None
def get_ec_connector_stats(self) -> "ECConnectorStats | None":
"""
Get the EC connector stats collected during the last interval.
Callable on either a worker-side or scheduler-side connector
instance: the worker-side instance reports stats gathered during
cache save/load, while the scheduler-side instance reports stats
gathered during scheduling decisions.
"""
return None
# ==============================
# Scheduler-side methods
# ==============================
@@ -336,3 +353,29 @@ class ECConnectorBase(ABC):
leave this as False.
"""
return False
@classmethod
def build_ec_connector_stats(
cls, data: dict[str, Any] | None = None
) -> "ECConnectorStats | None":
"""
ECConnectorStats resolution method. This method allows dynamically
registered connectors to return their own ECConnectorStats object,
which can implement custom aggregation logic on the data dict.
"""
return None
@classmethod
def build_prom_metrics(
cls,
vllm_config: "VllmConfig",
metric_types: dict[type["PromMetric"], type["PromMetricT"]],
labelnames: list[str],
per_engine_labelvalues: dict[int, list[object]],
) -> "ECConnectorPromMetrics | None":
"""
Create an ECConnectorPromMetrics subclass which should register
per-connector Prometheus metrics and implement observe() to
expose connector transfer stats via Prometheus.
"""
return None