Skip to content

[mem] Introduce PoolStats dataclass; unify pool metrics and token_usage#22554

Merged
hnyls2002 merged 7 commits intomainfrom
lsyin/cleanup-metrics
Apr 11, 2026
Merged

[mem] Introduce PoolStats dataclass; unify pool metrics and token_usage#22554
hnyls2002 merged 7 commits intomainfrom
lsyin/cleanup-metrics

Conversation

@hnyls2002
Copy link
Copy Markdown
Collaborator

Summary

  • Introduce PoolStats dataclass to replace raw tuple returns from _get_token_info, _get_swa_token_info, _get_mamba_token_info
  • Add get_pool_stats() as a single entry point that dispatches by pool type (supports swa + ssm coexistence)
  • Move common metric logic into PoolStats methods: get_general_token_stats(), get_general_memory_usage(), get_prefill_usage_msg_parts(), get_decode_usage_msg_parts()
  • Deduplicate 5 call sites in scheduler_metrics_mixin.py that each had 10-30 line if/elif/else chains

Net -17 lines. No behavioral change to mem checker logic.

Test plan

  • Existing unit test updated (test_scheduler_pause_generation.py)
  • CI: /rerun-test test_scheduler_pause_generation.py

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@hnyls2002 hnyls2002 changed the title [mem] Introduce PoolStats dataclass to consolidate pool metrics [mem] Introduce PoolStats dataclass; unify pool metrics and token_usage Apr 10, 2026
@hnyls2002 hnyls2002 merged commit c2821df into main Apr 11, 2026
183 of 203 checks passed
@hnyls2002 hnyls2002 deleted the lsyin/cleanup-metrics branch April 11, 2026 03:35
pyc96 pushed a commit to pyc96/sglang that referenced this pull request Apr 14, 2026
yhyang201 pushed a commit to yhyang201/sglang that referenced this pull request Apr 22, 2026
@hnyls2002 hnyls2002 mentioned this pull request Apr 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant