base: 35 RPS; safety, 75 RPS

# What does this PR do?


## Test Plan
# What does this PR do?


## Test Plan
This commit is contained in:
Eric Huang 2025-09-02 14:00:23 -07:00
parent faf891b40c
commit c3fa3e6333
5 changed files with 41 additions and 4 deletions

View file

@ -73,6 +73,7 @@ from llama_stack.providers.inline.telemetry.meta_reference.telemetry import (
TelemetryAdapter,
)
from llama_stack.providers.utils.telemetry.tracing import (
BACKGROUND_LOGGER,
CURRENT_TRACE_CONTEXT,
end_trace,
setup_logger,
@ -204,6 +205,10 @@ async def sse_generator(event_gen_coroutine):
async def log_request_pre_validation(request: Request):
# Skip expensive body parsing if debug logging is disabled
if not logger.isEnabledFor(logging.DEBUG):
return
if request.method in ("POST", "PUT", "PATCH"):
try:
body_bytes = await request.body()
@ -305,6 +310,10 @@ class TracingMiddleware:
logger.debug(f"Bypassing custom routing for FastAPI built-in path: {path}")
return await self.app(scope, receive, send)
# Quick exit if telemetry is disabled - skip expensive route matching and tracing
if BACKGROUND_LOGGER is None:
return await self.app(scope, receive, send)
if not hasattr(self, "route_impls"):
self.route_impls = initialize_route_impls(self.impls, self.external_apis)