diff --git a/vllm/v1/engine/async_llm.py b/vllm/v1/engine/async_llm.py index d23602eaaffa..f57075c6fa82 100644 --- a/vllm/v1/engine/async_llm.py +++ b/vllm/v1/engine/async_llm.py @@ -143,6 +143,7 @@ def __init__( engine_idxs=self.engine_core.engine_ranks_managed, custom_stat_loggers=stat_loggers, enable_default_loggers=log_stats, + client_count=client_count, ) self.logger_manager.log_engine_initialized() diff --git a/vllm/v1/metrics/loggers.py b/vllm/v1/metrics/loggers.py index f480344c854f..347185d8341e 100644 --- a/vllm/v1/metrics/loggers.py +++ b/vllm/v1/metrics/loggers.py @@ -652,6 +652,7 @@ def __init__( engine_idxs: Optional[list[int]] = None, custom_stat_loggers: Optional[list[StatLoggerFactory]] = None, enable_default_loggers: bool = True, + client_count: int = 1, ): self.engine_idxs = engine_idxs if engine_idxs else [0] @@ -660,7 +661,12 @@ def __init__( factories.extend(custom_stat_loggers) if enable_default_loggers and logger.isEnabledFor(logging.INFO): - factories.append(LoggingStatLogger) + if client_count > 1: + logger.warning( + "AsyncLLM created with api_server_count more than 1; " + "disabling stats logging to avoid incomplete stats.") + else: + factories.append(LoggingStatLogger) # engine_idx: StatLogger self.per_engine_logger_dict: dict[int, list[StatLoggerBase]] = {}