|
10 | 10 |
|
11 | 11 | from vllm.config import SupportsMetricsInfo, VllmConfig |
12 | 12 | from vllm.logger import init_logger |
| 13 | +from vllm.plugins import load_plugins_by_group |
13 | 14 | from vllm.v1.core.kv_cache_utils import PrefixCachingMetrics |
14 | 15 | from vllm.v1.engine import FinishReason |
15 | 16 | from vllm.v1.metrics.prometheus import unregister_vllm_metrics |
@@ -637,6 +638,23 @@ def build_1_2_5_buckets(max_value: int) -> list[int]: |
637 | 638 | return build_buckets([1, 2, 5], max_value) |
638 | 639 |
|
639 | 640 |
|
| 641 | +def load_stat_logger_plugin_factories() -> list[StatLoggerFactory]: |
| 642 | + factories: list[StatLoggerFactory] = [] |
| 643 | + |
| 644 | + for name, plugin_class in load_plugins_by_group( |
| 645 | + "vllm.stat_logger_plugins").items(): |
| 646 | + if not isinstance(plugin_class, type) or not issubclass( |
| 647 | + plugin_class, StatLoggerBase): |
| 648 | + logger.warning( |
| 649 | + "Stat logger plugin %s is not a valid subclass " |
| 650 | + "of StatLoggerBase. Skipping.", name) |
| 651 | + continue |
| 652 | + |
| 653 | + factories.append(plugin_class) |
| 654 | + |
| 655 | + return factories |
| 656 | + |
| 657 | + |
640 | 658 | class StatLoggerManager: |
641 | 659 | """ |
642 | 660 | StatLoggerManager: |
@@ -664,6 +682,9 @@ def __init__( |
664 | 682 | if custom_stat_loggers is not None: |
665 | 683 | factories.extend(custom_stat_loggers) |
666 | 684 |
|
| 685 | + # Load plugin-based stat loggers |
| 686 | + factories.extend(load_stat_logger_plugin_factories()) |
| 687 | + |
667 | 688 | if enable_default_loggers and logger.isEnabledFor(logging.INFO): |
668 | 689 | if client_count > 1: |
669 | 690 | logger.warning( |
|
0 commit comments