cleanup prometheus logging

Signed-off-by: Robert Shaw <robshaw@redhat.com>
This commit is contained in:
Robert Shaw 2025-07-20 14:41:55 +00:00
parent de91a3cd6a
commit e08e1e99ee
2 changed files with 6 additions and 6 deletions

View File

@ -99,7 +99,7 @@ class AsyncLLM(EngineClient):
self.stat_loggers = setup_default_loggers( self.stat_loggers = setup_default_loggers(
vllm_config=vllm_config, vllm_config=vllm_config,
log_stats=self.log_stats, log_stats=self.log_stats,
num_engines=vllm_config.parallel_config.data_parallel_size, engine_num=vllm_config.parallel_config.data_parallel_size,
custom_stat_loggers=stat_loggers, custom_stat_loggers=stat_loggers,
) )

View File

@ -149,11 +149,11 @@ class PrometheusStatLogger(StatLoggerBase):
_histogram_cls = prometheus_client.Histogram _histogram_cls = prometheus_client.Histogram
_spec_decoding_cls = SpecDecodingProm _spec_decoding_cls = SpecDecodingProm
def __init__(self, vllm_config: VllmConfig, num_engines: int = 1): def __init__(self, vllm_config: VllmConfig, engine_num: int = 1):
# unregister_vllm_metrics() # unregister_vllm_metrics()
self.vllm_config = vllm_config self.vllm_config = vllm_config
self.engine_indexes = range(num_engines) self.engine_indexes = range(engine_num)
# Use this flag to hide metrics that were deprecated in # Use this flag to hide metrics that were deprecated in
# a previous release and which will be removed future # a previous release and which will be removed future
self.show_hidden_metrics = \ self.show_hidden_metrics = \
@ -633,7 +633,7 @@ def build_1_2_5_buckets(max_value: int) -> list[int]:
def setup_default_loggers( def setup_default_loggers(
vllm_config: VllmConfig, vllm_config: VllmConfig,
log_stats: bool, log_stats: bool,
num_engines: int, engine_num: int,
custom_stat_loggers: Optional[list[StatLoggerFactory]] = None, custom_stat_loggers: Optional[list[StatLoggerFactory]] = None,
) -> Optional[tuple[list[list[StatLoggerBase]], PrometheusStatLogger]]: ) -> Optional[tuple[list[list[StatLoggerBase]], PrometheusStatLogger]]:
"""Setup logging and prometheus metrics.""" """Setup logging and prometheus metrics."""
@ -649,12 +649,12 @@ def setup_default_loggers(
factories.append(LoggingStatLogger) factories.append(LoggingStatLogger)
stat_loggers: list[list[StatLoggerBase]] = [] stat_loggers: list[list[StatLoggerBase]] = []
for engine_idx in range(num_engines): for engine_idx in range(engine_num):
per_engine_stat_loggers: list[StatLoggerBase] = [] per_engine_stat_loggers: list[StatLoggerBase] = []
for logger_factory in factories: for logger_factory in factories:
per_engine_stat_loggers.append( per_engine_stat_loggers.append(
logger_factory(vllm_config, engine_idx)) logger_factory(vllm_config, engine_idx))
stat_loggers.append(per_engine_stat_loggers) stat_loggers.append(per_engine_stat_loggers)
prom_stat_logger = PrometheusStatLogger(vllm_config, num_engines) prom_stat_logger = PrometheusStatLogger(vllm_config, engine_num)
return stat_loggers, prom_stat_logger return stat_loggers, prom_stat_logger