Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

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

mateo-berrie4f958d7cf17
diff --git a/gateway/routes/allowlist.py b/gateway/routes/allowlist.py
index 92b73867e67..3733072a948 100644
--- a/gateway/routes/allowlist.py
+++ b/gateway/routes/allowlist.py
@@ -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",
}
)
diff --git a/tests/test_litellm/proxy/test_component_allowlists.py b/tests/test_litellm/proxy/test_component_allowlists.py
index 0fdb43d60da..3073908fa54 100644
--- a/tests/test_litellm/proxy/test_component_allowlists.py
+++ b/tests/test_litellm/proxy/test_component_allowlists.py
@@ -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.