fix: report streaming upstream failures to the request log - #375
Merged
Merged
Conversation
Signed-off-by: Priyanshu-u07 <connect.priyanshu8271@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
stream_upstreamcannot raise past its consumer without ending the stream, so it reports upstream failures as data frames. Theexceptclauses inlogging_generator_wrappertherefore never fire, and the only detector wasa substring check for
Upstream Error— text that appears in alogger.errorline, not in any frame the generator emits.It never matched. Circuit breaker trips, size-limit aborts and provider 500s were all recorded as
status_code=200with no error message, in the inference log and in the Prometheus counters alike, sinceRequestLogger.logpasses the same value tometrics.observe_request.The failure now travels out of band in a sink dict, the way
usage_trackeralready does three lines above. No message text is matched anywhere, so rewording one cannot break it again.Two things worth a look
The client sees nothing new.
json.dumpsproduces bytes identical to the hand-written frames, so this changes what is logged, not what is sent. There is a test pinning that.Statuses are no longer flattened to one code. A circuit breaker trip logs 503, a rejected upstream URL 500, and genuine upstream failures 502. That is a judgement call rather than a correctness one, and worth disagreeing with if you would rather a gateway reported 502 for anything upstream.
Closes #373