Ghraven opened a new pull request, #918:
URL: https://github.com/apache/burr/pull/918

   ## Problem
   
   `telemetry/ui/scripts/token_costs.py` refreshes pricing metadata from 
LiteLLM using an unbounded `requests.get()` call. If the remote endpoint 
stalls, the script can hang indefinitely. It also writes the generated JSON 
without an explicit text encoding, which makes the output depend on the 
platform default encoding.
   
   ## Before / after
   
   Before:
   - remote fetches had no timeout
   - HTTP error responses were passed to `response.json()`
   - `model_costs.json` was written with the process default text encoding
   
   After:
   - the fetch is bounded with a 30 second timeout
   - HTTP failures are surfaced via `raise_for_status()` before parsing JSON
   - the generated JSON is written with `encoding="utf-8"`
   
   ## Verification
   
   - `python -m py_compile telemetry/ui/scripts/token_costs.py`
   - `git diff --check`
   - Ran the script from a temp working directory and confirmed it generated 
`model_costs.json`


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to