Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
ff93550
expose requests preemptions to ods
kingsmad Sep 20, 2025
3bdd7f4
Merge branch 'vllm-project:main' into export-D82650207
kingsmad Sep 20, 2025
5ab6dc4
Merge remote-tracking branch 'upstream/main' into export-D82650207
kingsmad Sep 21, 2025
c3f7ed3
[MM][Perf] Minor Optimization on Qwen3-VL `fast_pos_embed_interpolate…
ywang96 Sep 21, 2025
a2c21a2
[Bugfix] Typos in error message for missing model config file (#25339)
simondanielsson Sep 21, 2025
6d949db
[Optimization] Cache chat template result when processor fails to be …
DarkLight1337 Sep 21, 2025
b2e5dc1
[V0 Deprecation] Remove V0 Sequence class & Sampler (#25332)
WoosukKwon Sep 21, 2025
66b1e08
[V0 Deprecation] Remove async_output_proc, preemption mode, delay fac…
WoosukKwon Sep 21, 2025
0de3fac
feat: Enable engine-level arguments with speculators models (#25250)
rahul-tuli Sep 21, 2025
69a7601
[V0 Deprecation] Remove V0 sampling metadata (#25345)
WoosukKwon Sep 21, 2025
9f092a0
[Perf] Further optimization for Qwen3-VL `fast_pos_embed_interpolate`…
Isotr0py Sep 21, 2025
6217239
Remove V0 attention backends (#25351)
WoosukKwon Sep 21, 2025
a271abf
[Bugfix][V0 Deprecation][CI] use async mock and await for async metho…
KKSK-DON Sep 21, 2025
73f2bef
Multimodal - audio tests (#25285)
debroy-rh Sep 21, 2025
1ffb412
[Model] Support Dots OCR (#24645)
ywang96 Sep 22, 2025
b608cb4
[Docs] GSM8K Accuracy Evaluation doc update (#25360)
david6666666 Sep 22, 2025
b012cf6
[Bugfix] Fix hermes tool parser handling of non-string argument types…
david6666666 Sep 22, 2025
13af566
add unit test
kingsmad Sep 22, 2025
afc679e
Merge branch 'vllm-project:main' into export-D82650207
kingsmad Sep 22, 2025
170ba7d
format code
kingsmad Sep 22, 2025
a436358
Merge remote-tracking branch 'upstream/main' into export-D82650207
kingsmad Sep 29, 2025
8e75688
Merge branch 'vllm-project:main' into export-D82650207
kingsmad Sep 29, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 51 additions & 1 deletion tests/v1/metrics/test_engine_logger_apis.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
import pytest

from vllm.v1.engine.async_llm import AsyncEngineArgs, AsyncLLM
from vllm.v1.metrics.loggers import LoggingStatLogger
from vllm.v1.metrics.ray_wrappers import RayPrometheusStatLogger
from vllm.v1.metrics.stats import IterationStats


class DummyStatLogger:
Expand All @@ -31,6 +33,16 @@ def log_engine_initialized(self):
self.engine_initialized = True


class DummyLoggingStatLogger(LoggingStatLogger):
"""
A dummy logging stat logger for testing purposes.
Implemented the record and log APIs
"""

def get_num_preempted_reqs(self) -> int:
return self.num_preempted_reqs


@pytest.fixture
def log_stats_enabled_engine_args():
"""
Expand Down Expand Up @@ -62,7 +74,7 @@ async def test_async_llm_replace_default_loggers(
@pytest.mark.asyncio
async def test_async_llm_add_to_default_loggers(log_stats_enabled_engine_args):
"""
It's still possible to use custom stat loggers exclusively by passing
It's still possible to use custom stat loggers exclusively by passing
disable_log_stats=True in addition to a list of custom stat loggers.
"""
# Create engine_args with disable_log_stats=True for this test
Expand All @@ -81,3 +93,41 @@ async def test_async_llm_add_to_default_loggers(log_stats_enabled_engine_args):
assert engine.log_stats

engine.shutdown()


@pytest.mark.asyncio
async def test_logger_iteration_stats(log_stats_enabled_engine_args):
"""
"""
# Create engine_args with disable_log_stats=True for this test
disabled_log_engine_args = copy.deepcopy(log_stats_enabled_engine_args)
disabled_log_engine_args.disable_log_stats = True

# Disable default loggers; pass custom stat logger to the constructor
engine = AsyncLLM.from_engine_args(disabled_log_engine_args,
stat_loggers=[DummyLoggingStatLogger])

dummy_logger = engine.logger_manager.per_engine_logger_dict[0][0]

assert len(engine.logger_manager.per_engine_logger_dict[0]) == 1
assert isinstance(dummy_logger, DummyLoggingStatLogger)

stats_1 = IterationStats()
stats_1.num_preempted_reqs = 1
stats_1.num_generation_tokens = 10
stats_1.num_prompt_tokens = 100

stats_2 = IterationStats()
stats_2.num_preempted_reqs = 2
stats_2.num_generation_tokens = 20
stats_2.num_prompt_tokens = 200

# Expect the record will update the local iteration stats correctly
dummy_logger.record(scheduler_stats=None, iteration_stats=stats_1)
dummy_logger.record(scheduler_stats=None, iteration_stats=stats_2)

assert dummy_logger.num_preempted_reqs == 3
assert dummy_logger.num_generation_tokens == 30
assert dummy_logger.num_prompt_tokens == 300

engine.shutdown()
2 changes: 2 additions & 0 deletions vllm/v1/metrics/loggers.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,13 @@ def _reset(self, now):
# Tracked stats over current local logging interval.
self.num_prompt_tokens: int = 0
self.num_generation_tokens: int = 0
self.num_preempted_reqs: int = 0

def _track_iteration_stats(self, iteration_stats: IterationStats):
# Save tracked stats for token counters.
self.num_prompt_tokens += iteration_stats.num_prompt_tokens
self.num_generation_tokens += iteration_stats.num_generation_tokens
self.num_preempted_reqs += iteration_stats.num_preempted_reqs
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we seem to already have counter_num_preempted_reqs? can we use that? cc: @markmc

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yeqcharlotte Good point but currently the counter_num_preempted_reqs is in the PrometheusStatLogger and our predictor use our own loggers.


def _get_throughput(self, tracked_stats: int, now: float) -> float:
# Compute summary metrics for tracked stats
Expand Down