Lazy evaluate debug log in pass-through endpoint (#30177)

* Pass through debug lazy logging

* fix(proxy): convert remaining eager pass-through debug logs to lazy formatting
This commit is contained in:
nina-hu 2026-06-10 23:39:00 -07:00 • committed by GitHub
parent 8dd7ab7f3f
commit 1406905905
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -174,9 +174,7 @@ async def chat_completion_pass_through_endpoint( # noqa: PLR0915
data["adapter_id"] = adapter_id
verbose_proxy_logger.debug(
"Request received by LiteLLM:\n{}".format(json.dumps(data, indent=4)),
)
verbose_proxy_logger.debug("Request received by LiteLLM:\n%s", data)
data["model"] = (
general_settings.get("completion_model", None) # server default
or user_model # model name passed via cli args
@ -298,7 +296,7 @@ async def chat_completion_pass_through_endpoint( # noqa: PLR0915
)
)
verbose_proxy_logger.debug("\nResponse from Litellm:\n{}".format(response))
verbose_proxy_logger.debug("\nResponse from Litellm:\n%s", response)
return response
except Exception as e:
await proxy_logging_obj.post_call_failure_hook(
@ -811,9 +809,10 @@ async def pass_through_request( # noqa: PLR0915
else:
_parsed_body = await _read_request_body(request)
verbose_proxy_logger.debug(
"Pass through endpoint sending request to \nURL {}\nheaders: {}\nbody: {}\n".format(
url, headers, _parsed_body
)
"Pass through endpoint sending request to \nURL %s\nheaders: %s\nbody: %s\n",
url,
headers,
_parsed_body,
)
### COLLECT GUARDRAILS FOR PASSTHROUGH ENDPOINT ###