From c08fb6d4561f4754d0f5bc6abd9ddb8d5265f017 Mon Sep 17 00:00:00 2001 From: Robert Shaw Date: Sun, 20 Jul 2025 16:57:45 +0000 Subject: [PATCH] updated Signed-off-by: Robert Shaw --- vllm/v1/metrics/loggers.py | 39 ++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/vllm/v1/metrics/loggers.py b/vllm/v1/metrics/loggers.py index b6b8b6d0a4d86..d8d9eb463f4ec 100644 --- a/vllm/v1/metrics/loggers.py +++ b/vllm/v1/metrics/loggers.py @@ -155,6 +155,7 @@ class PrometheusStatLogger(StatLoggerBase): engine_indexes: Optional[list[int]] = None): if engine_indexes is None: engine_indexes = [0] + self.engine_indexes = engine_indexes unregister_vllm_metrics() self.vllm_config = vllm_config @@ -449,26 +450,28 @@ class PrometheusStatLogger(StatLoggerBase): # ) def log_metrics_info(self, type: str, config_obj: SupportsMetricsInfo): - pass - # metrics_info = config_obj.metrics_info() - # metrics_info["engine"] = self.engine_index + metrics_info = config_obj.metrics_info() + metrics_info["engine"] = "" - # name, documentation = None, None - # if type == "cache_config": - # name = "vllm:cache_config_info" - # documentation = "Information of the LLMEngine CacheConfig" - # assert name is not None, f"Unknown metrics info type {type}" + name, documentation = None, None + if type == "cache_config": + name = "vllm:cache_config_info" + documentation = "Information of the LLMEngine CacheConfig" + assert name is not None, f"Unknown metrics info type {type}" - # # Info type metrics are syntactic sugar for a gauge permanently set to 1 # noqa: E501 - # # Since prometheus multiprocessing mode does not support Info, emulate - # # info here with a gauge. - # info_gauge = self._gauge_cls( - # name=name, - # documentation=documentation, - # multiprocess_mode="mostrecent", - # labelnames=metrics_info.keys(), - # ).labels(**metrics_info) - # info_gauge.set(1) + # Info type metrics are syntactic sugar for a gauge permanently set to 1 # noqa: E501 + # Since prometheus multiprocessing mode does not support Info, emulate + # info here with a gauge. + info_gauge = self._gauge_cls( + name=name, + documentation=documentation, + multiprocess_mode="mostrecent", + labelnames=metrics_info.keys(), + ) + for engine_index in self.engine_indexes: + metrics_info = config_obj.metrics_info() + metrics_info["engine"] = str(engine_index) + info_gauge.labels(*metrics_info.set(1)) def record(self, scheduler_stats: Optional[SchedulerStats],