observability: publish the generated forward-pass-metrics endpoint to the bags (#33337)
When --forward-pass-metrics-ipc-name is left unset the reporter generates an endpoint and has to hand it to external consumers (the documented contract is that they read it back from the server config). That readback is the scheduler's get_internal_state, which already reports get_context().resolved_server_args_dict(), so the write moves to get_context().override and the read alongside it to get_observability() — the endpoint still shows up in /server_info's internal_states, and the ServerArgs instance stops being a message bus. The test's server_args stand-in (a SimpleNamespace with a hand-rolled override) becomes a real published config, so the reporter exercises the same accessors as production. Writer ratchet 19 -> 18.
This commit is contained in:
@@ -26,7 +26,7 @@ from sglang.srt.observability.metrics_collector import (
|
||||
SchedulerStats,
|
||||
compute_routing_key_stats,
|
||||
)
|
||||
from sglang.srt.runtime_context import get_spec
|
||||
from sglang.srt.runtime_context import get_context, get_observability, get_spec
|
||||
from sglang.srt.utils.device_timer import DeviceTimer
|
||||
from sglang.srt.utils.scheduler_status_logger import SchedulerStatusLogger
|
||||
|
||||
@@ -215,11 +215,11 @@ class SchedulerMetricsReporter:
|
||||
self.scheduler._fpm_worker_id = (
|
||||
self.scheduler.server_args.forward_pass_metrics_worker_id
|
||||
)
|
||||
base_endpoint = self.scheduler.server_args.forward_pass_metrics_ipc_name
|
||||
base_endpoint = get_observability().forward_pass_metrics_ipc_name
|
||||
if base_endpoint is None:
|
||||
ipc_path = tempfile.NamedTemporaryFile(delete=False).name
|
||||
base_endpoint = f"ipc://{ipc_path}"
|
||||
self.scheduler.server_args.override(
|
||||
get_context().override(
|
||||
"metrics_reporter.ipc_endpoint",
|
||||
forward_pass_metrics_ipc_name=base_endpoint,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user