Skip to content

Conversation

@ptovam
Copy link
Contributor

@ptovam ptovam commented Aug 7, 2025

Purpose

✨ Add Support for Custom Stat Logger Plugins

This PR introduces support for registering custom StatLoggerBase implementations through Python entry-points, using the plugin group vllm.stat_logger_plugins.

This allows users to inject custom metric loggers into the vLLM runtime without modifying internal code.

🔧 What’s New

  • Added support for a new plugin group: vllm.stat_logger_plugins
  • Plugins should return a class that subclasses StatLoggerBase.
  • These plugin loggers are automatically loaded and used in addition to the built-in ones.

📍 Example: Registering a Custom Logger
In your package’s pyproject.toml or setup.py, declare:

[project.entry-points."vllm.stat_logger_plugins"]
my_custom_logger = "mylogger.stat_logger:MyStatLogger"

Test Plan

To validate the plugin mechanism, a dummy stat logger plugin was implemented and tested using the following commands:

pip install tests/plugins/vllm_add_dummy_stat_logger/
pytest -vs tests/plugins_tests/test_stats_logger_plugins.py
pip uninstall -y tests/plugins/vllm_add_dummy_stat_logger/

Test Result

All tests passed

(Optional) Documentation Update

Updated docs/design/plugin_system.md to document the new plugin type:

  • Described vllm.stat_logger_plugins as a supported plugin group
  • Clarified plugin value definition to allow functions or modules

Essential Elements of an Effective PR Description Checklist

  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.

@github-actions
Copy link

github-actions bot commented Aug 7, 2025

👋 Hi! Thank you for contributing to the vLLM project.

💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels.

Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run fastcheck CI which starts running only a small and essential subset of CI tests to quickly catch errors. You can run other CI tests on top of those by going to your fastcheck build on Buildkite UI (linked in the PR checks section) and unblock them. If you do not have permission to unblock, ping simon-mo or khluu to add you in our Buildkite org.

Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging.

To run CI, PR reviewers can either: Add ready label to the PR or enable auto-merge.

🚀

@mergify mergify bot added documentation Improvements or additions to documentation ci/build v1 labels Aug 7, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a plugin system for custom StatLoggerBase implementations, which is a great addition for enhancing observability. The implementation is generally well-done, including tests and documentation updates. However, I've found a critical issue in the plugin loading logic that could lead to an engine crash if a plugin is not a class. Additionally, there's an inconsistency in the documentation regarding the plugin's entry point type. My feedback aims to address these issues to improve the robustness and clarity of this new feature.

@mergify
Copy link

mergify bot commented Sep 3, 2025

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @ptovam.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify bot added the needs-rebase label Sep 3, 2025
@njhill
Copy link
Member

njhill commented Sep 4, 2025

@ptovam you may want to update this now that #20952 is merged.

The behaviour now is that custom stats loggers will augment the built-in ones unless disable_log_stats=True.

@ptovam ptovam force-pushed the vllm_stat_logger_plugins branch from 0d423ed to beeeec7 Compare September 7, 2025 05:53
@mergify mergify bot removed the needs-rebase label Sep 7, 2025
@ptovam ptovam marked this pull request as ready for review September 7, 2025 05:56
@ptovam
Copy link
Contributor Author

ptovam commented Sep 7, 2025

Hi @njhill, thanks! Updated — let me know if this aligns well.

@ptovam ptovam force-pushed the vllm_stat_logger_plugins branch from beeeec7 to f10d313 Compare September 16, 2025 14:26
@ptovam ptovam force-pushed the vllm_stat_logger_plugins branch 2 times, most recently from 42dc8b5 to 01ae8e1 Compare September 29, 2025 15:08
@mergify
Copy link

mergify bot commented Oct 8, 2025

Documentation preview: https://vllm--22456.org.readthedocs.build/en/22456/

@ptovam ptovam force-pushed the vllm_stat_logger_plugins branch 2 times, most recently from ada4a9e to c69098a Compare October 15, 2025 19:43
Copy link
Member

@njhill njhill left a comment

Choose a reason for hiding this comment

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

Thanks @ptovam, looks great. I just have one comment.

@ptovam ptovam force-pushed the vllm_stat_logger_plugins branch from c69098a to 56074a1 Compare October 18, 2025 17:55
Copy link
Member

@njhill njhill left a comment

Choose a reason for hiding this comment

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

Thanks @ptovam

@njhill njhill added the ready ONLY add when PR is ready to merge/full CI is needed label Oct 18, 2025
@njhill njhill merged commit 83e760c into vllm-project:main Oct 18, 2025
49 checks passed
@ptovam ptovam deleted the vllm_stat_logger_plugins branch October 18, 2025 22:46
lywa1998 pushed a commit to lywa1998/vllm that referenced this pull request Oct 20, 2025
adabeyta pushed a commit to adabeyta/vllm that referenced this pull request Oct 20, 2025
albertoperdomo2 pushed a commit to albertoperdomo2/vllm that referenced this pull request Oct 23, 2025
xuebwang-amd pushed a commit to xuebwang-amd/vllm that referenced this pull request Oct 24, 2025
xuebwang-amd pushed a commit to xuebwang-amd/vllm that referenced this pull request Oct 24, 2025
0xrushi pushed a commit to 0xrushi/vllm that referenced this pull request Oct 26, 2025
0xrushi pushed a commit to 0xrushi/vllm that referenced this pull request Oct 26, 2025
ilmarkov pushed a commit to neuralmagic/vllm that referenced this pull request Nov 7, 2025
rtourgeman pushed a commit to rtourgeman/vllm that referenced this pull request Nov 10, 2025
Zhathw pushed a commit to Zhathw/vllm that referenced this pull request Nov 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci/build documentation Improvements or additions to documentation ready ONLY add when PR is ready to merge/full CI is needed v1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants