fix(gateway): serve /debug/memory/summary on the data plane so the memory regression test can read each gateway's RSS

This commit is contained in:
mateo-berri 2026-09-10 18:12:40 -07:00
parent 93e2393c53
commit e4f958d7cf
2 changed files with 17 additions and 1 deletions

View file

@ -3,7 +3,8 @@
The gateway exposes the LLM data-plane surface: chat/completions, embeddings,
audio, batches, files, fine-tuning, rerank, ocr, rag, video, search, image,
responses, vector stores, passthrough providers, realtime websockets, MCP
tool-call endpoints, and operational endpoints (/health, /metrics).
tool-call endpoints, and operational endpoints (/health, /metrics, and the
/debug/memory/summary read of the serving worker's RSS).
Any path not listed here is dropped from the gateway process so management/UI
endpoints don't ride on the same pods.
@ -121,6 +122,7 @@ GATEWAY_EXACT_PATHS: frozenset[str] = frozenset(
"/docs/oauth2-redirect",
"/redoc",
"/test",
"/debug/memory/summary",
}
)

View file

@ -196,6 +196,20 @@ def test_gateway_drops_ui_and_swagger_mounts():
f"Mount {path} must not be served by the gateway"
def test_gateway_keeps_memory_summary_and_trims_the_other_debug_routes():
"""The gateway serves /debug/memory/summary, since the RSS that matters is the
serving worker's and the memory regression e2e test reads it on every gateway
replica; the heavier and mutating /debug/memory routes stay on the backend."""
debug_memory_routes = {
getattr(r, "path"): r for r in app.router.routes if str(getattr(r, "path", "")).startswith("/debug/memory/")
}
assert {"/debug/memory/summary", "/debug/memory/details", "/debug/memory/gc/configure"} <= set(debug_memory_routes)
assert _is_gateway_route(debug_memory_routes["/debug/memory/summary"]), \
"/debug/memory/summary must survive the gateway route trim"
for path in ("/debug/memory/details", "/debug/memory/gc/configure"):
assert not _is_gateway_route(debug_memory_routes[path]), f"{path} must not be served by the gateway"
def test_every_app_mount_is_assigned_to_a_component():
"""Every Mount on the proxy app must be consciously assigned to a component.