[Feat] metrics: Expose multi-detokenizer router CPU usage (#43323)

Co-authored-by: raghul chandramouli <raghul@c1xind0180-0243.local>
Co-authored-by: Xinyuan Tong <xinyuantong.cs@gmail.com>
Co-authored-by: Xinyuan Tong <115166877+JustinTong0323@users.noreply.github.com>
Co-authored-by: hnyls2002 <lsyincs@gmail.com>
This commit is contained in:
Raghul chandramouli
2026-10-14 17:17:22 -07:00
committed by GitHub
co-authored by raghul chandramouli Xinyuan Tong Xinyuan Tong hnyls2002
parent 0f36c8015c
commit 0536cec73d
3 changed files with 30 additions and 1 deletions
+1
View File
@@ -1081,6 +1081,7 @@ class Engine(EngineScoreMixin, EngineBase):
router_proc = mp.Process(
target=run_multi_detokenizer_router_process,
args=(worker_ipc_names, server_args, port_args),
kwargs={"enable_metrics": get_observability().enable_metrics},
)
router_proc.start()
processes.append(router_proc)
@@ -63,6 +63,7 @@ from sglang.srt.managers.load_snapshot import (
zmq_reader_owner,
)
from sglang.srt.managers.tokenizer_manager import TokenizerManager
from sglang.srt.observability.cpu_monitor import start_cpu_monitor_thread
from sglang.srt.runtime_context import (
get_disagg,
)
@@ -792,6 +793,8 @@ def run_multi_detokenizer_router_process(
ipc_name_list: List[str],
server_args: ServerArgs,
port_args: PortArgs,
*,
enable_metrics: bool,
):
kill_itself_when_parent_died()
setproctitle.setproctitle("sglang::detokenizer_router")
@@ -800,6 +803,8 @@ def run_multi_detokenizer_router_process(
router = None
try:
if enable_metrics:
start_cpu_monitor_thread("detokenizer_router")
router = MultiDetokenizerRouter(ipc_name_list, port_args)
router.event_loop()
except Exception: