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(
vllm_config=vllm_config,
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,
)

View File

@ -149,11 +149,11 @@ class PrometheusStatLogger(StatLoggerBase):
_histogram_cls = prometheus_client.Histogram
_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()
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
# a previous release and which will be removed future
self.show_hidden_metrics = \
@ -633,7 +633,7 @@ def build_1_2_5_buckets(max_value: int) -> list[int]:
def setup_default_loggers(
vllm_config: VllmConfig,
log_stats: bool,
num_engines: int,
engine_num: int,
custom_stat_loggers: Optional[list[StatLoggerFactory]] = None,
) -> Optional[tuple[list[list[StatLoggerBase]], PrometheusStatLogger]]:
"""Setup logging and prometheus metrics."""
@ -649,12 +649,12 @@ def setup_default_loggers(
factories.append(LoggingStatLogger)
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] = []
for logger_factory in factories:
per_engine_stat_loggers.append(
logger_factory(vllm_config, engine_idx))
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