Signed-off-by: Robert Shaw <robshaw@redhat.com>
This commit is contained in:
Robert Shaw 2025-07-20 16:57:45 +00:00
parent 5e6114df5d
commit c08fb6d456

View File

@ -155,6 +155,7 @@ class PrometheusStatLogger(StatLoggerBase):
engine_indexes: Optional[list[int]] = None): engine_indexes: Optional[list[int]] = None):
if engine_indexes is None: if engine_indexes is None:
engine_indexes = [0] engine_indexes = [0]
self.engine_indexes = engine_indexes
unregister_vllm_metrics() unregister_vllm_metrics()
self.vllm_config = vllm_config self.vllm_config = vllm_config
@ -449,26 +450,28 @@ class PrometheusStatLogger(StatLoggerBase):
# ) # )
def log_metrics_info(self, type: str, config_obj: SupportsMetricsInfo): def log_metrics_info(self, type: str, config_obj: SupportsMetricsInfo):
pass metrics_info = config_obj.metrics_info()
# metrics_info = config_obj.metrics_info() metrics_info["engine"] = ""
# metrics_info["engine"] = self.engine_index
# name, documentation = None, None name, documentation = None, None
# if type == "cache_config": if type == "cache_config":
# name = "vllm:cache_config_info" name = "vllm:cache_config_info"
# documentation = "Information of the LLMEngine CacheConfig" documentation = "Information of the LLMEngine CacheConfig"
# assert name is not None, f"Unknown metrics info type {type}" 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 # Info type metrics are syntactic sugar for a gauge permanently set to 1 # noqa: E501
# # Since prometheus multiprocessing mode does not support Info, emulate # Since prometheus multiprocessing mode does not support Info, emulate
# # info here with a gauge. # info here with a gauge.
# info_gauge = self._gauge_cls( info_gauge = self._gauge_cls(
# name=name, name=name,
# documentation=documentation, documentation=documentation,
# multiprocess_mode="mostrecent", multiprocess_mode="mostrecent",
# labelnames=metrics_info.keys(), labelnames=metrics_info.keys(),
# ).labels(**metrics_info) )
# info_gauge.set(1) 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, def record(self,
scheduler_stats: Optional[SchedulerStats], scheduler_stats: Optional[SchedulerStats],