[Observability] Expose python/rust frontend identity in /server_info (#39993)

Signed-off-by: Sage Ahrac <sagiahrak@gmail.com>
This commit is contained in:
Sage
2026-09-21 23:32:52 +08:00
committed by GitHub
parent 50ec9702d0
commit 14e9c40a72
3 changed files with 4 additions and 0 deletions
@@ -846,6 +846,7 @@ async def server_info():
"startup_time": _global_state.tokenizer_manager.startup_time, "startup_time": _global_state.tokenizer_manager.startup_time,
"internal_states": internal_states, "internal_states": internal_states,
"version": __version__, "version": __version__,
"frontend": "python",
# Structured KV-event publisher descriptor for KV-aware routers. # Structured KV-event publisher descriptor for KV-aware routers.
# `None` when publishing is disabled or misconfigured; see # `None` when publishing is disabled or misconfigured; see
# `runtime_context.describe_kv_events_publisher` for the contract. # `runtime_context.describe_kv_events_publisher` for the contract.
@@ -173,6 +173,7 @@ fn shape_server_info(msgpack: &[u8], server_args: &ServerArgs) -> Result<Vec<u8>
"max_context_length": server_args.model_config.context_len, "max_context_length": server_args.model_config.context_len,
"max_total_num_tokens": server_args.max_total_num_tokens, "max_total_num_tokens": server_args.max_total_num_tokens,
"version": server_args.version, "version": server_args.version,
"frontend": "rust",
"internal_states": [serde_json::Value::Object(state_out)], "internal_states": [serde_json::Value::Object(state_out)],
}); });
serde_json::to_vec(&response).map_err(|e| e.to_string()) serde_json::to_vec(&response).map_err(|e| e.to_string())
@@ -240,5 +241,6 @@ mod tests {
assert!(state0.get("api_key").is_none()); assert!(state0.get("api_key").is_none());
// Curated top-level config comes from typed accessors, not the dump. // Curated top-level config comes from typed accessors, not the dump.
assert_eq!(v["model_path"], "/m"); assert_eq!(v["model_path"], "/m");
assert_eq!(v["frontend"], "rust");
} }
} }
@@ -523,6 +523,7 @@ class TestServerInfoExistingFieldsPreserved(CustomTestCase):
self.assertIn("internal_states", info) self.assertIn("internal_states", info)
self.assertIn("version", info) self.assertIn("version", info)
self.assertEqual(info["frontend"], "python")
def test_kv_events_config_raw_field_still_surfaced(self): def test_kv_events_config_raw_field_still_surfaced(self):
# The new structured `kv_events` block sits alongside the # The new structured `kv_events` block sits alongside the