mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-10-08 13:00:52 +00:00
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:
parent
faf891b40c
commit
c3fa3e6333
5 changed files with 41 additions and 4 deletions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue