|
12 | 12 | from vllm.distributed.kv_transfer.kv_connector.v1.metrics import ( |
13 | 13 | KVConnectorLogging) |
14 | 14 | from vllm.logger import init_logger |
| 15 | +from vllm.plugins import load_plugins_by_group |
15 | 16 | from vllm.v1.core.kv_cache_utils import PrefixCachingMetrics |
16 | 17 | from vllm.v1.engine import FinishReason |
17 | 18 | from vllm.v1.metrics.prometheus import unregister_vllm_metrics |
@@ -657,6 +658,23 @@ def build_1_2_5_buckets(max_value: int) -> list[int]: |
657 | 658 | return build_buckets([1, 2, 5], max_value) |
658 | 659 |
|
659 | 660 |
|
| 661 | +def load_stat_logger_plugin_factories() -> list[StatLoggerFactory]: |
| 662 | + factories: list[StatLoggerFactory] = [] |
| 663 | + |
| 664 | + for name, plugin_class in load_plugins_by_group( |
| 665 | + "vllm.stat_logger_plugins").items(): |
| 666 | + if not isinstance(plugin_class, type) or not issubclass( |
| 667 | + plugin_class, StatLoggerBase): |
| 668 | + logger.warning( |
| 669 | + "Stat logger plugin %s is not a valid subclass " |
| 670 | + "of StatLoggerBase. Skipping.", name) |
| 671 | + continue |
| 672 | + |
| 673 | + factories.append(plugin_class) |
| 674 | + |
| 675 | + return factories |
| 676 | + |
| 677 | + |
660 | 678 | class StatLoggerManager: |
661 | 679 | """ |
662 | 680 | StatLoggerManager: |
@@ -684,6 +702,9 @@ def __init__( |
684 | 702 | if custom_stat_loggers is not None: |
685 | 703 | factories.extend(custom_stat_loggers) |
686 | 704 |
|
| 705 | + # Load plugin-based stat loggers |
| 706 | + factories.extend(load_stat_logger_plugin_factories()) |
| 707 | + |
687 | 708 | if enable_default_loggers and logger.isEnabledFor(logging.INFO): |
688 | 709 | if client_count > 1: |
689 | 710 | logger.warning( |
|
0 commit comments