[observability] add ServerArgs.stat_loggers for pluggable metrics backend (#24610)

Signed-off-by: Dongjun Na <kmu5544616@gmail.com>
This commit is contained in:
Dongjun Na
2026-05-24 22:41:28 +08:00
committed by GitHub
parent b6f71d5850
commit 9d50cd9742
9 changed files with 411 additions and 22 deletions
+11 -2
View File
@@ -30,7 +30,11 @@ import torch.distributed
from sglang.srt.environ import envs
from sglang.srt.model_executor.forward_batch_info import ForwardBatch
from sglang.srt.observability.metrics_collector import ExpertDispatchCollector
from sglang.srt.observability.metrics_collector import (
STAT_LOGGER_ROLE_EXPERT_DISPATCH,
ExpertDispatchCollector,
resolve_collector_class,
)
from sglang.srt.server_args import ServerArgs
from sglang.srt.utils import Withable, get_device, get_int_env_var
@@ -672,7 +676,12 @@ class _UtilizationRateAccumulatorMixin(_Accumulator):
self.window_sizes = [10, 100, 1000]
self._history = _DequeCollection(maxlens=self.window_sizes)
self._rank = torch.distributed.get_rank()
self._expert_dispatch_collector = ExpertDispatchCollector(
expert_dispatch_cls = resolve_collector_class(
self._server_args,
STAT_LOGGER_ROLE_EXPERT_DISPATCH,
ExpertDispatchCollector,
)
self._expert_dispatch_collector = expert_dispatch_cls(
self._expert_location_metadata.ep_size
)
self._metric_heatmap_collection_counter = 0