Log AI Gateway client HTTP errors
What does this MR do and why?
Previously:
- 4xx errors in the AI Gateway client would quietly be retried.
- 5xx errors would fail immediately without any indication.
This commit logs all AI Gateway HTTP errors with their status codes
and bodies in llm.log to make it easier to troubleshoot server
errors.
References
We are using this in Project Panda to troubleshoot upstream issues.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
| Before | After |
|---|---|
How to set up and validate locally
- Set
export AI_GATEWAY_URL=https://httpstat.us/500 - Invoke some AI Gateway request.
- View
log/llm.log.
Edited by Stan Hu