nic-6443 opened a new pull request, #13323:
URL: https://github.com/apache/apisix/pull/13323

   The previous commit (bda084d52) added upstream nginx variable support for 
ai-proxy cosocket transport but missed passing `response_length` to 
`update_upstream_state`. This caused `$upstream_response_length` to always be 0 
in access logs.
   
   This tracks total bytes read in both `parse_response` and 
`parse_streaming_response`, then passes the value as `response_length` to 
`update_upstream_state` after body consumption is complete.
   
   Changes:
   - `ai-providers/base.lua`: store `res._upstream_bytes` in all return paths 
of both parse methods
   - `ai-proxy/base.lua`: pass `response_length = res._upstream_bytes or 0` in 
the final `update_upstream_state` call
   - Added tests (TEST 5-7 in `ai-proxy-upstream-vars.t`) verifying non-zero 
`$upstream_response_length` for both streaming and non-streaming
   - Updated docs to include `upstream_response_length` in the supported 
variables list


-- 
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